订单相关修改同步test

This commit is contained in:
GaoHao
2024-10-16 09:05:52 +08:00
parent 3288d1ed9b
commit 3ad4d7af68
16 changed files with 363 additions and 4678 deletions

View File

@@ -314,7 +314,7 @@
* 立即付款
*/
async showpopupclick(item) {
let res = await this.api.payorderPay({
let res = await this.api.orderPay({
orderId: item.id,
// #ifdef MP-WEIXIN
payType: 'wechatPay',
@@ -328,8 +328,8 @@
title: '加载中',
mask: true
})
// #ifdef MP-WEIXIN
uni.requestPayment({
// #ifdef MP-WEIXIN
provider: 'wxpay', //支付类型-固定值
partnerid: res.data.appId, // 微信支付商户号
timeStamp: res.data.timeStamp, // 时间戳(单位:秒)
@@ -337,60 +337,55 @@
package: res.data.package, // 固定值
signType: res.data.signType, //固定值
paySign: res.data.paySign, //签名
// #endif
// #ifdef MP-ALIPAY
provider: 'alipay', //支付类型-固定值
orderInfo: res.data.tradeNo, // 微信支付商户号
// #endif
success: (res) => {
let _this = this
uni.showToast({
title: "支付成功"
})
setTimeout(res => {
uni.hideLoading()
uni.switchTab({
url: '/pages/order/order'
});
}, 500)
this.paymodfiyOrderInfo()
// #ifdef MP-WEIXIN
uni.requestSubscribeMessage({
tmplIds: ['z0fUG7-jhSfYCrw6poOvSRzh4_hgnPkm_5C7E5s5bCQ'],
complete() {
// uni.cache.set('shopUser', '') //删除shopUser
setTimeout(res => {
uni.hideLoading()
uni.switchTab({
url: '/pages/order/order'
});
}, 500)
_this.paymodfiyOrderInfo()
},
})
// #endif
// #ifdef MP-ALIPAY
_this.paymodfiyOrderInfo()
uni.switchTab({
url: '/pages/order/order'
});
// #endif
},
fail: (err) => {
fail: async(err) => {
let res = await this.api.cancelOrderPay({
orderId: item.id,
}) //判断是否支付成功
uni.showToast({
icon: 'none',
title: '支付失败'
})
setTimeout(res => {
uni.hideLoading()
uni.switchTab({
url: '/pages/order/order'
});
}, 500)
}
});
// #endif
// #ifdef MP-ALIPAY
uni.requestPayment({
provider: 'alipay', //支付类型-固定值
orderInfo: res.data.tradeNo, // 微信支付商户号
success: (res) => {
let _this = this
// uni.requestSubscribeMessage({
// tmplIds: ['z0fUG7-jhSfYCrw6poOvSRzh4_hgnPkm_5C7E5s5bCQ'],
// complete() {
// uni.showToast({
// title: "支付成功"
// })
// // uni.cache.set('shopUser', '') //删除shopUser
// },
// })
_this.paymodfiyOrderInfo()
uni.redirectTo({
url: '/pagesOrder/order_detail/index?orderId=' + _this
.listinfoid
});
},
fail: () => {
uni.hideLoading()
}
});
// #endif
}
},
/**

View File

@@ -40,7 +40,7 @@
</view>
</view>
</view>
<view class="shop-item-remark" v-if="item.productId!=-999">
<!-- <view class="shop-item-remark" v-if="item.productId!=-999">
<view class="label">备注</view>
<u--input
placeholder="商品备注(选填)"
@@ -48,7 +48,7 @@
v-model="item.note"
@blur="productBlur(item)"
></u--input>
</view>
</view> -->
</view>
</view>
</scroll-view>
@@ -60,31 +60,53 @@
<script>
export default {
props:{
cartLists:{
type: Object
},
cartLists_count: {
type: Number,
default: 0
},
showCart:{
type: Boolean
},
shopId:{
type: String,
default: ''
},
tableCode:{
type: String,
default: ''
}
},
data() {
return {
}
},
props:{
cartLists:{
type: Object
},
cartLists_count: {
type: String
},
showCart:{
type: Boolean
watch:{
tableCode:{
immediate: true,
handler (newVal) {
console.log(newVal)
console.log("tableCode1==",this.tableCode)
}
},
shopId:{
type: String
immediate: true,
handler (newVal) {
console.log(newVal)
console.log("shopId1==",this.shopId)
}
},
tableCode:{
type: String
}
},
mounted() {
console.log("tableCode3==",this.tableCode)
console.log("shopId3==",this.shopId)
},
methods: {
@@ -101,6 +123,8 @@
* @param {Object} a
*/
async cartListadd(item, index, c) {
console.log(this.shopId)
console.log(this.tableCode)
try {
if ( c == "+" && item.isVip == 1){
return;
@@ -116,6 +140,7 @@
"userId": uni.cache.get('userInfo').id,
"tableId": this.tableCode,
}
this.$emit("addCart",params)
} catch (e) {
//TODO handle the exception

View File

@@ -30,7 +30,6 @@
}
},
props:{
cartListsdatashow: {
type: Boolean
},
@@ -49,15 +48,24 @@
shopId:{
type: String
},
dinersNum:{
type: String
},
tableCode:{
type: String
},
},
mounted() {
console.log("tableCode==",this.tableCode)
console.log("shopId==",this.shopId)
},
watch:{
tableCode(newVal, oldValue) {
console.log(newVal)
console.log("tableCode2==",this.tableCode)
},
shopId(newVal, oldValue) {
console.log(newVal)
console.log("shopId2==",this.tableCode)
},
},
methods: {
@@ -80,8 +88,9 @@
})
return false
}
uni.navigateTo({
url: `/pagesOrder/confirm_order/index?storeInfo=${encodeURIComponent(JSON.stringify(this.storeInfo))}&cartLists=${JSON.stringify(this.cartLists)}&tableCode=${this.tableCode||''}&dinersNum=${this.dinersNum||''}`
url: `/pagesOrder/confirm_order/index?storeInfo=${encodeURIComponent(JSON.stringify(this.storeInfo))}&cartLists=${JSON.stringify(this.cartLists)}&tableCode=${this.tableCode||''}`
});
},

File diff suppressed because it is too large Load Diff

View File

@@ -208,10 +208,10 @@
<!-- 购物车 -->
<shoppingCart ref="shoppingCart" :shopId="shopId" :tableCode="tableCode" :cartLists_count="cartLists_count" :cartLists="cartLists" :showCart="showCart" @addCart="addCart" @close="close"></shoppingCart>
<shoppingCart v-if="tableCode&&shopId" ref="shoppingCart" :shopId="shopId" :tableCode="tableCode" :cartLists_count="cartLists_count" :cartLists="cartLists" :showCart="showCart" @addCart="addCart" @close="close"></shoppingCart>
<!-- 购物车结算 -->
<shoppingCartBilling ref="shoppingCartBilling" :orderdetailFlag="orderdetailFlag" :cartListsdatashow="cartListsdatashow" :shopId="shopId" :tableCode="tableCode" :dinersNum="dinersNum" :storeInfo="shopInfo.storeInfo" :cartLists_count="cartLists_count" :cartLists="cartLists" :showCart="showCart" @isOpen="isOpen"></shoppingCartBilling>
<shoppingCartBilling v-if="tableCode&&shopId" ref="shoppingCartBilling" :cartListsdatashow="cartListsdatashow" :shopId="shopId" :tableCode="tableCode" :storeInfo="shopInfo.storeInfo" :cartLists_count="cartLists_count" :cartLists="cartLists" :showCart="showCart" @isOpen="isOpen"></shoppingCartBilling>
<view class="placedOrderTip" @click="placedOrder" v-if="tableCode&&shopInfo.shopTableInfo&&shopInfo.shopTableInfo.orderId&&shopInfo.storeInfo.registerType == 'restaurant'"><u-avatar :src="src" shape="circle"></u-avatar><view style="margin-left: 8rpx;">已下单菜品</view></view>
@@ -372,9 +372,8 @@
scrollxleft: true,
forceUpdate: false,
shopExtend: null,
shopId: null,
tableCode: null,
dinersNum: null,
shopId: "",
tableCode: "",
}
},
onPageScroll(e) {
@@ -414,10 +413,8 @@
if ( e.tableCode ) {
this.tableCode = e.tableCode
}
if ( e.dinersNum ) {
this.dinersNum = e.dinersNum;
}
},
onUnload() {
if (this.socketTicket) {
this.socketTicket.Close()
@@ -434,13 +431,21 @@
},
async onShow() {
let _this = this;
this.orderdetailFlag = true;
uni.pageScrollTo({
scrollTop: 0,
duration: 0
});
_this.getLocation()
this.$nextTick(() => {
uni.pageScrollTo({
scrollTop: 0,
duration: 0
});
if ( this.shopId ) {
this.productqueryProduct() //list 数据
this.getShopUserInfo() //list 数据
this.handlemessage() //监听websocket返回
this.getShopExtend();
} else {
this.getLocation()
}
});
},
methods: {
/**
@@ -586,7 +591,7 @@
searchStatus (e) {
if ( e == "searchClick" ) {
uni.navigateTo({
url: `/pages/order_food/order_food_search?tableCode=${this.tableCode}&dinersNum=${this.dinersNum}&shopId=${this.shopId}`
url: `/pages/order_food/order_food_search?tableCode=${this.tableCode}&shopId=${this.shopId}`
});
}
},

File diff suppressed because it is too large Load Diff

View File

@@ -91,10 +91,10 @@
</view>
<!-- 购物车 -->
<shoppingCart ref="shoppingCart" :shopId="shopId" :tableCode="tableCode" :cartLists_count="cartLists_count" :cartLists="cartLists" :showCart="showCart" @addCart="addCart" @close="close"></shoppingCart>
<shoppingCart v-if="shopId&&tableCode" ref="shoppingCart" :shopId="shopId" :tableCode="tableCode" :cartLists_count="cartLists_count" :cartLists="cartLists" :showCart="showCart" @addCart="addCart" @close="close"></shoppingCart>
<!-- 购物车结算 -->
<shoppingCartBilling ref="shoppingCartBilling" :cartListsdatashow="cartListsdatashow" :shopId="shopId" :tableCode="tableCode" :dinersNum="dinersNum" :storeInfo="shopInfo.storeInfo" :cartLists_count="cartLists_count" :cartLists="cartLists" :showCart="showCart" @isOpen="isOpen"></shoppingCartBilling>
<shoppingCartBilling v-if="shopId&&tableCode" ref="shoppingCartBilling" :cartListsdatashow="cartListsdatashow" :shopId="shopId" :tableCode="tableCode" :storeInfo="shopInfo.storeInfo" :cartLists_count="cartLists_count" :cartLists="cartLists" :showCart="showCart" @isOpen="isOpen"></shoppingCartBilling>
<!-- 规格 -->
<u-popup :show="showShopsku" :round="20" mode="bottom" @close="showShopsku = false;pagemetashow=false"
@@ -213,7 +213,6 @@
shopId: null,
tableCode: null,
dinersNum: null,
}
},
onPageScroll(e) {
@@ -229,7 +228,6 @@
onLoad(e) {
if ( e.shopId ) { this.shopId = e.shopId }
if ( e.tableCode ) { this.tableCode = e.tableCode }
if ( e.dinersNum ) { this.dinersNum = e.dinersNum }
},
onUnload() {
if (this.socketTicket) {
@@ -252,6 +250,7 @@
this.productqueryShop();
},
methods: {
/**