diff --git a/api/order.js b/api/order.js
index 403eb0d..f227e97 100644
--- a/api/order.js
+++ b/api/order.js
@@ -23,4 +23,9 @@ export const rePaymentApi = (data)=>{
//订单数量统计
export const orderCountApi = (data)=>{
return request.post('/order/RetailOrder/order_count', data);
+}
+
+//取消订单
+export const cancelOrderApi = (data)=>{
+ return request.post('/order/RetailOrder/cancel_order', data);
}
\ No newline at end of file
diff --git a/components/modal.vue b/components/modal.vue
index e39a18f..fd831f5 100644
--- a/components/modal.vue
+++ b/components/modal.vue
@@ -4,8 +4,8 @@
{{title}}
{{content}}
- {{cancleText}}
- {{confirmText}}
+ {{cancleText}}
+ {{confirmText}}
diff --git a/pageQuota/quotation/detail.vue b/pageQuota/quotation/detail.vue
new file mode 100644
index 0000000..02409e3
--- /dev/null
+++ b/pageQuota/quotation/detail.vue
@@ -0,0 +1,8 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pagesOrder/detail/detail.vue b/pagesOrder/detail/detail.vue
index 52080ec..ecb2049 100644
--- a/pagesOrder/detail/detail.vue
+++ b/pagesOrder/detail/detail.vue
@@ -104,7 +104,7 @@
取消订单
- 立即支付 ¥{{datas.total}}
+ 立即支付 ¥{{datas.total}}
@@ -128,17 +128,26 @@
import addressPopup from "@/components/addressPopup.vue";
import orderCanclePopup from "@/components/orderCanclePopup.vue";
import modal from "@/components/modal.vue";
- import { orderDetailApi, rePaymentApi } from "@/api/order.js"
+ import { orderDetailApi, cancelOrderApi, rePaymentApi } from "@/api/order.js"
import { addressListsApi, merchantListApi } from "@/api/user.js";
const showCancel = ref(false);
const submitCancel = (e) => {
showCancel.value = false;
- console.log(e);
- uni.showToast({
- title: '取消成功',
- icon: 'none'
+ cancelOrderApi({
+ order_id: datas.value.id,
+ value: e.value
+ }).then(res=>{
+ uni.showToast({
+ title: '取消成功',
+ icon: 'none'
+ })
+ uni.navigateBack({
+ success: () => {
+ uni.$emit('reLoadOrderList')
+ }
+ });
})
}
@@ -154,6 +163,8 @@
timer = setInterval(updateCountdown, 1000);
updateCountdown();
}
+ }).catch(err=>{
+ uni.navigateBack();
})
}
@@ -197,7 +208,35 @@
order_id: datas.value.id,
pay_type: 1
}).then(res=>{
- console.log(res);
+ if(!res.data?.nonceStr) return uni.$u.toast('支付失败!');
+ uni.requestPayment({
+ provider: 'wxpay',
+ timeStamp: res.data.timeStamp,
+ nonceStr: res.data.nonceStr,
+ package: res.data.package,
+ signType: res.data.signType,
+ paySign: res.data.paySign,
+ success: (e) => {
+ if(e.errMsg == 'requestPayment:ok'){
+ uni.showModal({
+ title: '订单支付成功',
+ confirmText: '确认',
+ success: (e) => {
+ uni.navigateBack({
+ success: () => {
+ uni.$emit('reLoadOrderList')
+ }
+ });
+ }
+ })
+ }else uni.$u.toast('支付失败')
+ },
+ fail: (e) => {
+ uni.$u.toast('用户取消支付')
+ }
+ })
+ }).catch(err=>{
+ uni.$u.toast('网络错误')
})
}
diff --git a/pagesOrder/order/component/good.vue b/pagesOrder/order/component/good.vue
index ba78298..4de4a00 100644
--- a/pagesOrder/order/component/good.vue
+++ b/pagesOrder/order/component/good.vue
@@ -27,7 +27,7 @@
取消订单
- 立即支付
+ 立即支付
@@ -67,10 +67,14 @@
})
}
- const emit = defineEmits(['cancleOrder']);
+ const emit = defineEmits(['cancleOrder', 'rePay']);
const cancleOrder = ()=>{
emit('cancleOrder', props.datas)
}
+
+ const rePay = ()=>{
+ emit('rePay', props.datas)
+ }
\ No newline at end of file
diff --git a/pagesOrder/settle/settle.vue b/pagesOrder/settle/settle.vue
index 9aac80f..065b410 100644
--- a/pagesOrder/settle/settle.vue
+++ b/pagesOrder/settle/settle.vue
@@ -108,6 +108,7 @@
-->
+<<<<<<< HEAD
@@ -125,6 +126,25 @@
提交订单
+=======
+
+
+
+ 共 {{ cartList.length }} 款
+
+ 合计:
+ ¥
+
+ {{c_price(orderInfo.total, 0)}}
+ .{{c_price(orderInfo.total, 1)}}
+
+
+
+
+ 提交订单
+
+
+>>>>>>> b6496db8bd748ff7488207e5479f7e6a6d79cbcb
@@ -165,6 +185,7 @@
remark: ""
})
+<<<<<<< HEAD
const isAddress = ref(false);
const toastAddressShow = ref(false);
@@ -261,6 +282,100 @@
isAddress.value = true;
submitOrder();
}
+=======
+
+ // 地址相关
+ const addressList = ref([]);
+ const getAddressList = ()=>{
+ addressListsApi().then(res=>{
+ addressList.value = res.data.lists;
+ addressList.value.forEach(item=>{
+ if(item.is_default) {
+ addressInfo.value = item;
+ isAddress.value = true;
+ }
+ })
+ if(!isAddress.value && addressList.value.length>0){
+ addressInfo.value = addressList.value[0];
+ isAddress.value = true;
+ }
+ })
+ }
+ // 选择地址
+ const showAddress = ref(false);
+ const addressInfo = ref({});
+ const changeAddress = (e) => {
+ addressInfo.value = e;
+ showAddress.value = false;
+ isAddress.value = true;
+ }
+ const openAddress = ()=>{
+ if(addressList.length>0) showAddress.value=true;
+ else uni.navigateTo({
+ url: '/pagesOrder/addressEdit/addressEdit'
+ })
+ }
+
+ // 提货点相关
+ const shopListShow = ref(false);
+ const merchantList = ref([]);
+ const myAddressInfo = ref({
+ long: "",
+ lat: ""
+ })
+ const shopInfo = ref({
+ mer_id: ''
+ });
+ const getMerchantList = (mer_name=null)=>{
+ merchantListApi({
+ ...myAddressInfo.value,
+ mer_name: mer_name ? mer_name : ''
+ }).then(res=>{
+ merchantList.value = res.data.lists;
+ if(mer_name===null && myAddressInfo.value.long && merchantList.value.length>0 && !shopInfo.value.mer_id) {
+ shopInfo.value = merchantList.value[0];
+ }
+ })
+ }
+ getMerchantList('');
+ // 定位
+ const LoadAddress = ()=>{
+ uni.getLocation({
+ success: (res) => {
+ },
+ fail: (err) => {
+ uni.$u.toast('定位失败, 请手动选择提货点!')
+ },
+ complete: (res) => {
+ myAddressInfo.value.long = res.longitude || "";
+ myAddressInfo.value.lat = res.latitude || "";
+ getMerchantList();
+ }
+ })
+ }
+ LoadAddress();
+ const changeShop = (e)=>{
+ shopInfo.value = e;
+ shopListShow.value = false;
+ }
+ const searchShop = (e)=>{
+ getMerchantList(e)
+ }
+
+ // 选择地址
+ const addAddress = () => {
+ toastAddressShow.value = false;
+ nextTick(()=>{
+ showAddress.value = true;
+ })
+ }
+ // 继续支付
+ const goPay = ()=>{
+ toastAddressShow.value = false;
+ isAddress.value = true;
+ submitOrder();
+ }
+>>>>>>> b6496db8bd748ff7488207e5479f7e6a6d79cbcb
// 提交订单
const submitOrder = () => {
@@ -285,6 +400,7 @@
mer_id: shopInfo.value.mer_id,
pay_type: 1
}).then(res=>{
+ if(!res.data?.nonceStr) return uni.$u.toast('支付失败!');
uni.requestPayment({
provider: 'wxpay',
timeStamp: res.data.timeStamp,
@@ -311,17 +427,8 @@
uni.$u.toast('用户取消支付')
}
})
- // uni.showModal({
- // title: '订单支付成功',
- // confirmText: '查看订单',
- // cancelText: '继续购买',
- // success: (e) => {
- // if(e.confirm) uni.navigateTo({
- // url: '/pagesOrder/order/order'
- // })
- // else uni.navigateBack();
- // }
- // })
+ }).catch(err=>{
+ uni.$u.toast('网络错误')
})
}
diff --git a/store/user.js b/store/user.js
index cfea7ce..de65108 100644
--- a/store/user.js
+++ b/store/user.js
@@ -24,7 +24,7 @@ const useUserStore = defineStore("user", () => {
}
// #ifdef H5
- token.value = "31f74a72e2d05673ec14d2a6408718ef"
+ token.value = "f9421a985006bf3f73bbaff6193da353"
userInfo.value = {
avatar: "https://lihaiim.oss-cn-chengdu.aliyuncs.com/image/admin/default_avatar.png",
id: 9,
@@ -33,7 +33,7 @@ const useUserStore = defineStore("user", () => {
mobile: "19330904744",
nickname: "用户1714964250",
supplier: null,
- token: "33bb1ca5e6c98a6f948ad56b75471fb8"
+ token: "f9421a985006bf3f73bbaff6193da353"
}
// #endif