下单逻辑修改提测
This commit is contained in:
@@ -72,6 +72,7 @@
|
||||
code: uni.cache.get('tableCode'),
|
||||
})
|
||||
console.log()
|
||||
|
||||
if ( !data.data.shopTableInfo.choseCount ) {
|
||||
uni.pro.navigateTo('/pagesOrder/orderAMeal/index', {
|
||||
tableCode: tableCode,
|
||||
@@ -94,6 +95,7 @@
|
||||
shopId: uni.cache.get('shopId'),
|
||||
type: 'index',
|
||||
})
|
||||
|
||||
},
|
||||
getQueryString(url, name) { //解码
|
||||
var reg = new RegExp('(^|&|/?)' + name + '=([^&|/?]*)(&|/?|$)', 'i')
|
||||
|
||||
@@ -61,7 +61,8 @@
|
||||
<view class="shop-info">
|
||||
<view class="shop-item">
|
||||
<view class="cover" v-for="(item1,index1) in item.detailList" :key="index1">
|
||||
<u-image width="112" height="112" radius="20" :src="item1.productImg"></u-image>
|
||||
<u-image width="112" height="112" radius="20" :src='item1.productImg' v-if="item1.productId!=-999"></u-image>
|
||||
<u-image width="112" height="112" radius="20" :src="'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/table.png'" mode="heightFix" v-else></u-image>
|
||||
<text class="productName"> {{ item1.productName }} </text>
|
||||
</view>
|
||||
</view>
|
||||
@@ -366,24 +367,24 @@
|
||||
// #ifdef MP-ALIPAY
|
||||
uni.requestPayment({
|
||||
provider: 'alipay', //支付类型-固定值
|
||||
orderInfo: item.id, // 微信支付商户号
|
||||
|
||||
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
|
||||
});
|
||||
},
|
||||
})
|
||||
// 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()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<viwe>
|
||||
<view>
|
||||
<u-popup :show="showCart" :round="20" :safeAreaInsetBottom="false" :zIndex="98" :overlayStyle="{ zIndex: 98 }"
|
||||
@close="close">
|
||||
<view class="cart-list-wrap">
|
||||
@@ -15,24 +15,24 @@
|
||||
<view class="shop-item" v-for="(item,index) in cartLists.data" :key="item.id">
|
||||
<view class="shop-item-content">
|
||||
<view class="cover" v-if="item.productId!=-999">
|
||||
<u-image :src="item.coverImg" width="120" height="120"></u-image>
|
||||
<u-image :src="item.coverImg" width="120" radius="10" height="120"></u-image>
|
||||
</view>
|
||||
<view class="info">
|
||||
<view class="name"> {{ item.name }} </view>
|
||||
<view class="select-sku-wrap"> {{ item.skuName }} </view>
|
||||
|
||||
<view class="price-wrap" style="padding-top: 0;">
|
||||
|
||||
<view class="price-wrap" style="padding-top: 0;" >
|
||||
<view class="price">
|
||||
<text class="i">¥</text>
|
||||
<text class="num">{{ item.salePrice }}</text>
|
||||
</view>
|
||||
<view class="operation-wrap">
|
||||
<view class="btn" v-if="item.number&&item.productId!=-999" >
|
||||
<view class="btn" v-if="item.number" >
|
||||
<u-icon name="minus-circle-fill" size="50"></u-icon>
|
||||
<view class="btnClick" @click="cartListadd(item,index,'-')"></view>
|
||||
</view>
|
||||
<text class="num" v-if="item.number">{{ item.number }}</text>
|
||||
<view class="btn" v-if="item.productId!=-999">
|
||||
<view class="btn">
|
||||
<u-icon name="plus-circle-fill" :color="item.isVip == 1 ? '#CECECE' : '#E9AB7A'" size="50"></u-icon>
|
||||
<view class="btnClick" @click="cartListadd(item,index,'+')"></view>
|
||||
</view>
|
||||
@@ -40,7 +40,7 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="shop-item-remark">
|
||||
<view class="shop-item-remark" v-if="item.productId!=-999">
|
||||
<view class="label">备注</view>
|
||||
<u--input
|
||||
placeholder="商品备注(选填)"
|
||||
@@ -54,7 +54,7 @@
|
||||
</scroll-view>
|
||||
</view>
|
||||
</u-popup>
|
||||
</viwe>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
@@ -116,7 +116,7 @@
|
||||
"userId": uni.cache.get('userInfo').id,
|
||||
"tableId": this.tableCode,
|
||||
}
|
||||
this.addCart(params);
|
||||
this.$emit("addCart",params)
|
||||
} catch (e) {
|
||||
//TODO handle the exception
|
||||
}
|
||||
@@ -137,20 +137,9 @@
|
||||
"userId": uni.cache.get('userInfo').id,
|
||||
"tableId": this.tableCode,
|
||||
}
|
||||
this.addCart(params);
|
||||
this.$emit("addCart",params)
|
||||
},
|
||||
|
||||
/**
|
||||
* 添加到购物车
|
||||
*/
|
||||
async addCart(data) {
|
||||
let res = await this.api.cartAdd(data)
|
||||
if (res.code == 0) {
|
||||
this.showShopsku = false;
|
||||
this.pagemetashow = false;
|
||||
// this.$set(this, 'amountcartNumber', 0)
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 清空购物车
|
||||
*/
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<text class="i">¥</text>
|
||||
<text class="num">{{cartLists.amount||'0.00'}}</text>
|
||||
</view>
|
||||
<view class="btn" @tap="orderdetail">
|
||||
<view class="btn" @tap="$u.debounce(orderdetail, 500)" >
|
||||
<text class="t">去结算</text>
|
||||
</view>
|
||||
</view>
|
||||
@@ -26,11 +26,11 @@
|
||||
|
||||
data() {
|
||||
return {
|
||||
orderdetailFlag: true,
|
||||
|
||||
}
|
||||
},
|
||||
props:{
|
||||
|
||||
cartListsdatashow: {
|
||||
type: Boolean
|
||||
},
|
||||
@@ -72,10 +72,7 @@
|
||||
* 结算直接生成订单
|
||||
*/
|
||||
orderdetail() {
|
||||
if (!this.orderdetailFlag) {
|
||||
return;
|
||||
}
|
||||
this.orderdetailFlag = false;
|
||||
|
||||
if (this.cartLists.data.length == 0) {
|
||||
uni.showToast({
|
||||
title: '请先添加商品',
|
||||
|
||||
@@ -211,7 +211,7 @@
|
||||
<shoppingCart 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 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>
|
||||
|
||||
<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>
|
||||
|
||||
@@ -434,7 +434,7 @@
|
||||
},
|
||||
async onShow() {
|
||||
let _this = this;
|
||||
|
||||
this.orderdetailFlag = true;
|
||||
uni.pageScrollTo({
|
||||
scrollTop: 0,
|
||||
duration: 0
|
||||
@@ -534,7 +534,7 @@
|
||||
if (this.shopId) {params.shopId = this.shopId}
|
||||
let res = await this.api.productqueryShop(params)
|
||||
if (res.code == 0) {
|
||||
if ( !res.data.shopTableInfo.choseCount && !this.dinersNum ) {
|
||||
if ( !res.data.shopTableInfo.choseCount && this.tableCode && !this.dinersNum ) {
|
||||
uni.pro.navigateTo('/pagesOrder/orderAMeal/index', {
|
||||
tableCode: this.tableCode,
|
||||
shopId: res.data.storeInfo.id,
|
||||
@@ -586,7 +586,7 @@
|
||||
searchStatus (e) {
|
||||
if ( e == "searchClick" ) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/order_food/order_food_search?tableCode=${this.tableCode}&shopId=${this.shopId}`
|
||||
url: `/pages/order_food/order_food_search?tableCode=${this.tableCode}&dinersNum=${this.dinersNum}&shopId=${this.shopId}`
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
@@ -94,8 +94,7 @@
|
||||
<shoppingCart 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" :storeInfo="shopInfo.storeInfo" :cartLists_count="cartLists_count" :cartLists="cartLists" :showCart="showCart" @isOpen="isOpen"></shoppingCartBilling>
|
||||
|
||||
<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>
|
||||
|
||||
<!-- 规格 -->
|
||||
<u-popup :show="showShopsku" :round="20" mode="bottom" @close="showShopsku = false;pagemetashow=false"
|
||||
@@ -213,6 +212,8 @@
|
||||
systemInfo: getApp().globalData.systemInfo,
|
||||
|
||||
shopId: null,
|
||||
tableCode: null,
|
||||
dinersNum: null,
|
||||
}
|
||||
},
|
||||
onPageScroll(e) {
|
||||
@@ -226,9 +227,9 @@
|
||||
|
||||
},
|
||||
onLoad(e) {
|
||||
if ( e.shopId ) {
|
||||
this.shopId = e.shopId
|
||||
}
|
||||
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) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<viwe>
|
||||
<view>
|
||||
<view class="card_box">
|
||||
<view class="card_head_box">
|
||||
<view class="card_head_item" v-for="(item,index) in 8" :key="index"></view>
|
||||
@@ -19,7 +19,8 @@
|
||||
<view class="shop-info">
|
||||
<view class="item" v-for="(items,indexs) in item.info" :key="indexs">
|
||||
<view class="cover">
|
||||
<u-image width="152" height="152" radius="16" :src='items.productImg'></u-image>
|
||||
<u-image width="152" height="152" radius="16" :src='item.productImg' v-if="item.productId!=-999"></u-image>
|
||||
<u-image width="152" height="152" radius="16" :src="'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/table.png'" mode="heightFix" v-else></u-image>
|
||||
</view>
|
||||
<view class="info">
|
||||
<text class="productName">{{items.productName}}</text>
|
||||
@@ -87,7 +88,7 @@
|
||||
<text class="info">{{ listinfo.orderInfo.seatCount}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</viwe>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
|
||||
@@ -69,7 +69,8 @@
|
||||
<view class="shop-info">
|
||||
<view class="item" v-for="(item,index) in listinfo.details" :key="index">
|
||||
<view class="cover">
|
||||
<u-image width="152" height="152" radius="16" :src='item.productImg'></u-image>
|
||||
<u-image width="152" height="152" radius="16" :src='item.productImg' v-if="item.productId!=-999"></u-image>
|
||||
<u-image width="152" height="152" radius="16" :src="'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/table.png'" mode="heightFix" v-else></u-image>
|
||||
</view>
|
||||
<view class="info">
|
||||
<text class="productName">{{item.productName}}</text>
|
||||
|
||||
@@ -64,20 +64,18 @@
|
||||
<view class="content">
|
||||
<view class="title"> {{ listinfo.name }} </view>
|
||||
<view class="list_item" v-for="(item,index) in listinfo.details" :key="item.id">
|
||||
<view class="left">
|
||||
<image class="img" :src="item.coverImg || item.productImg || ''" mode="aspectFill"/>
|
||||
<view class="center">
|
||||
<view class="left" >
|
||||
<image class="img" v-if="item.productId!=-999" :src="item.coverImg || item.productImg || ''" mode="aspectFill"/>
|
||||
<image class="img" v-else :src="'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/table.png'" mode="heightFix"/>
|
||||
<view class="center" >
|
||||
<text class="center_title"> {{item.name || item.productName || "" }} </text>
|
||||
<text class="type"> {{ item.skuName || item.productSkuName || ""}} </text>
|
||||
<text class="num"> X{{ item.totalNumber || item.num}} </text>
|
||||
<text class="num" > X{{ item.totalNumber || item.num}} </text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="price"> ¥{{ item.totalAmount || item.priceAmount || 0}} </view>
|
||||
</view>
|
||||
<view class="cell_item" v-if="dinersNum">
|
||||
<view class="label">餐位费</view>
|
||||
<view class="value"><view>X{{dinersNum}}</view><view>¥{{dinersNum*storeInfo.tableFee}}</view></view>
|
||||
</view>
|
||||
|
||||
<!-- <view class="favorable" v-for="(item,index) in favorable" :key="index">
|
||||
<view class="favorable_left">
|
||||
<image class="icon" :src="item.url" mode="aspectFill"/>
|
||||
@@ -254,7 +252,6 @@
|
||||
if ( e.tableCode ) { this.tableCode = e.tableCode; }
|
||||
if ( e.dinersNum ) {
|
||||
this.dinersNum = e.dinersNum;
|
||||
this.listinfo.payAmount = (this.listinfo.payAmount + this.dinersNum * this.storeInfo.tableFee).toFixed(2);
|
||||
}
|
||||
|
||||
if ( this.storeInfo.eatModel.indexOf("dine-in") != -1 ) {
|
||||
@@ -362,9 +359,7 @@
|
||||
this.listinfoid = msg.data.id
|
||||
this.listinfo.details = msg.data.detailList;
|
||||
this.listinfo.payAmount = msg.data.amount;
|
||||
if ( this.dinersNum ) {
|
||||
this.listinfo.payAmount = (this.listinfo.payAmount + this.dinersNum * this.storeInfo.tableFee).toFixed(2);
|
||||
}
|
||||
|
||||
uni.$off('getMessage')
|
||||
this.orderorderInfo(1)
|
||||
break;
|
||||
@@ -375,9 +370,6 @@
|
||||
} else {
|
||||
this.listinfo.details = msg.data;
|
||||
this.listinfo.payAmount = msg.amount;
|
||||
if ( this.dinersNum ) {
|
||||
this.listinfo.payAmount = (this.listinfo.payAmount + this.dinersNum * this.storeInfo.tableFee).toFixed(2);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'order':
|
||||
@@ -394,9 +386,6 @@
|
||||
} else {
|
||||
this.listinfo.details = msg.data;
|
||||
this.listinfo.payAmount = msg.amount;
|
||||
if ( this.dinersNum ) {
|
||||
this.listinfo.payAmount = (this.listinfo.payAmount + this.dinersNum * this.storeInfo.tableFee).toFixed(2);
|
||||
}
|
||||
}
|
||||
this.isSocket = true;
|
||||
break;
|
||||
@@ -626,22 +615,21 @@
|
||||
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
|
||||
});
|
||||
},
|
||||
})
|
||||
// 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()
|
||||
@@ -1005,12 +993,14 @@
|
||||
}
|
||||
.list_item{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 32rpx;
|
||||
padding: 0 30rpx;
|
||||
box-sizing: border-box;
|
||||
.left{
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
.img{
|
||||
width: 142rpx;
|
||||
height: 142rpx;
|
||||
@@ -1022,6 +1012,7 @@
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
.center_title{
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
@@ -1037,6 +1028,10 @@
|
||||
|
||||
}
|
||||
}
|
||||
.num{
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
.price{
|
||||
font-size: 32rpx;
|
||||
color: #333;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<view class="num_item" :class="{'active':numIndex==index }">{{index+1}}</view>
|
||||
</view>
|
||||
<view class="item">
|
||||
<u--input custom-class="num_item" v-model="otherNum" :class="{'active':numIndex==-1 }" @focus="tabCut(-1)" @blur="blur()" border="none" type="number" maxlength="3"></u--input>
|
||||
<u--input class="num_item" v-model="otherNum" :class="{'active':numIndex==-1 }" @input="isOtherNum" @focus="tabCut(-1)" @blur="blur()" border="none" type="nubmer" maxlength="3"></u--input>
|
||||
</view>
|
||||
<!-- <view class="num_item" v-else :class="{'active':numIndex==-1 }">其</view> -->
|
||||
</view>
|
||||
@@ -22,9 +22,6 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -49,7 +46,13 @@
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
||||
|
||||
|
||||
isOtherNum (e) {
|
||||
this.$nextTick(() => {
|
||||
this.otherNum = this.otherNum.replace(/\D/g, '')
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 切换桌型
|
||||
*/
|
||||
|
||||
@@ -283,23 +283,24 @@
|
||||
// #ifdef MP-ALIPAY
|
||||
uni.requestPayment({
|
||||
provider: 'alipay', //支付类型-固定值
|
||||
orderInfo: res.data.appId, // 微信支付商户号
|
||||
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
|
||||
});
|
||||
},
|
||||
})
|
||||
// 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()
|
||||
|
||||
Reference in New Issue
Block a user