Browse Source

feat: 接口对接;

pull/1/head
fox 1 month ago
parent
commit
f8c90f0896
4 changed files with 40 additions and 17 deletions
  1. +10
    -0
      api/model/order.js
  2. +2
    -1
      components/order/orderCard.vue
  3. +13
    -1
      pages/index/center.vue
  4. +15
    -15
      pages_order/order/createOrder.vue

+ 10
- 0
api/model/order.js View File

@ -22,6 +22,16 @@ const api = {
auth: true,
showLoading: true,
},
/**
* 核销订单
*/
overOrder: {
url: '/order/overOrder',
method: 'POST',
limit: 500,
auth: true,
showLoading: true,
},
/**
* 查询订单列表
*/


+ 2
- 1
components/order/orderCard.vue View File

@ -79,8 +79,9 @@
},
onPay() {
// todo
this.$api('createSumOrderAgain', {
this.$api('payOrder', {
orderId : this.data.id,
// todo: payType -> (payType)0- 1-
}, res => {
if(res.code == 200){
uni.requestPaymentWxPay(res)


+ 13
- 1
pages/index/center.vue View File

@ -198,17 +198,29 @@
this.$refs.customerServicePopup.open(phone, title)
},
onScan() {
// todo
// todo check
uni.scanCode({
success: (res) => {
console.log(res);
if (res.result) {
//
console.log('扫码结果:', res.result);
this.$fetch('overOrder', res.result).then(() => {
uni.showToast({
title: '核销成功',
icon: 'none'
})
})
}
},
fail: (err) => {
console.error('扫码失败:', err);
uni.showToast({
title: '扫码失败',
icon: 'none'
})
}
});
},


+ 15
- 15
pages_order/order/createOrder.vue View File

@ -131,13 +131,12 @@
async fetchCreateOrder() {
// todo: check
let params = {
'massageItem.id': this.payOrderProduct[0].id,
itemId: this.payOrderProduct[0].id,
amount: this.totalPrice,
payType : this.payMethod,
// num: this.payOrderProduct[0].num,
// id: this.payOrderProduct[0].id,
// payType : this.payMethod,
// num: this.payOrderProduct[0].num,
// memberNum : 1,
}
@ -150,29 +149,30 @@
return res
},
async fetchPayOrder() {
// todo
let params = {
}
await this.$fetch('payOrder', params)
},
async submit() {
// todo
try {
const res = await this.fetchCreateOrder()
if (!res.success) {
return
}
if (this.payMethod == 1) { //
} else { //
await uni.requestPaymentWxPay(res)
}
uni.showToast({
title: '下单成功',
icon: 'none'
})
setTimeout(uni.redirectTo, 700, {
url: '/pages/index/order'
})
} catch (err) {
}


Loading…
Cancel
Save