订单相关修改同步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

@@ -16,7 +16,9 @@ export default {
getPopUpAd(data) {
return uni.api.get("/tbShopAd/list", data,false);
},
logincreateCardNo(data) { //获取会员码
return uni.api.get("/login/createCardNo", data);
},
productqueryShop(data) { //通过桌码获取店铺信息
return uni.api.get("/product/queryShop", data);
},
@@ -56,9 +58,13 @@ export default {
accountPay(data) {
return uni.api.get("/pay/accountPay", data);
},
payorderPay(data) { //订单支付
orderPay(data) { //订单支付
return uni.api.post("/pay/orderPay", data);
},
cancelOrderPay(data) { //订单支付
return uni.api.post("/notify/cancel", data);
},
paymodfiyOrderInfo(data) { //查询订单支付状态
return uni.api.post("/pay/modfiyOrderInfo", data);
},

View File

@@ -293,6 +293,9 @@ const getUserInfo = function (successCallback, failCallback) {
// #endif
}
const payment = function () {
}
uni.utils = {
md5,
@@ -311,5 +314,6 @@ uni.utils = {
getCurrentPage,
getCurrentRoute,
pluschooseImage,
getUserInfo
getUserInfo,
payment
}

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: {
/**

View File

@@ -19,7 +19,7 @@
<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='item.productImg' v-if="item.productId!=-999"></u-image>
<u-image width="152" height="152" radius="16" :src="items.productImg" v-if="items.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">
@@ -317,6 +317,7 @@
font-weight: bold;
font-size: 32rpx;
color: #333333;
padding-bottom: 32rpx;
}
.val{
display: flex;

View File

@@ -83,7 +83,14 @@
</view>
</view>
</view>
<view class="cell-item" v-if="listinfo.orderInfo.seatCount > 0">
<view class="label">餐位费</view>
<view class="val">
<view>X{{listinfo.orderInfo.seatCount}}</view>
<view style="font-size: 28rpx;"></view>
<view>{{listinfo.orderInfo.seatAmount}}</view>
</view>
</view>
<view class="total-wrap">
<view>合计</view>
<view class="price"> {{listinfo.payAmount}} </view>
@@ -330,12 +337,44 @@
}
}
}
.cell-item{
display: flex;
align-items: center;
justify-content: space-between;
padding: 32rpx 0;
.label{
font-weight: bold;
font-size: 28rpx;
color: #333333;
padding-bottom: 32rpx;
}
.val{
display: flex;
align-items: flex-end;
padding-bottom: 32rpx;
border-bottom: 2rpx dashed #e5e5e5;
view:nth-child(1){
font-weight: 400;
font-size: 24rpx;
color: #999999;
margin-right: 42rpx;
}
view:nth-child(2){
display: flex;
align-items: flex-end;
font-weight: bold;
font-size: 36rpx;
color: #333333;
}
}
}
.total-wrap {
width: 100%;
display: flex;
justify-content: space-between;
font-weight: 500;
font-weight: bold;
font-size: 28rpx;
color: #333;
.price{
font-weight: bold;
font-size: 32rpx;

View File

@@ -6,7 +6,7 @@
<u-radio-group v-model="radiovalue" iconPlacement="right" @change="groupChange" :size="28"
placement="column">
<block v-for="(item,index) in paymentMethodList" :key="index">
<view class="method_list" @click="groupChange(item.type,item.name)">
<view class="method_list" @click="groupChange(item.type)">
<view class="method_list_top">
<view class="method_list_top_left">
<image class="icon" :src="item.url" mode="aspectFill"/>
@@ -44,6 +44,11 @@
{ name: "支付宝支付", type: 3, url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/alipay.png"},
// #endif
],
paymentMethodName:[
{ name: "余额支付", type: 1, url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/wechat.png"},
{ name: "微信支付", type: 2, url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/weChat.png"},
{ name: "支付宝支付", type: 3, url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/alipay.png"},
],
radiovalue: 1, // 支付方式
ispws: false, // 输入支付密码
storeInfo: {},
@@ -52,7 +57,7 @@
props:{
amountVIP:{
type: Object
}
},
},
mounted() {
console.log(this.amountVIP)
@@ -63,9 +68,11 @@
* 监听支付方式切换
* @param {Object}
*/
groupChange(type,name) {
groupChange(type) {
console.log(type)
this.radiovalue = type;
this.$emit("groupChange",{type:type ,name:name })
let name = this.paymentMethodName[type-1].name;
this.$emit("groupChange",{type:type ,name: name })
},
@@ -74,7 +81,7 @@
*/
goRecharge() {
uni.pro.navigateTo('/pages/member/index', {
shopId: this.shopId
shopId: uni.cache.get('shopId')
})
},
}

View File

@@ -55,7 +55,7 @@
<view class="tableName">
<view>桌号</view>
<view class="name">{{ shopTableInfo.name }} </view>
<view class="num" v-if="dinersNum">{{ dinersNum }}</view>
<view class="num" v-if="shopTableInfo&&shopTableInfo.seatNum">{{ shopTableInfo.seatNum }}</view>
</view>
</view>
</view>
@@ -75,7 +75,14 @@
</view>
<view class="price"> {{ item.totalAmount || item.priceAmount || 0}} </view>
</view>
<view class="cell-item" v-if="shopTableInfo&&shopTableInfo.seatNum&&sendType=='table'">
<view class="label">餐位费</view>
<view class="val">
<view>X{{shopTableInfo.seatNum}}</view>
<view style="font-size: 28rpx;"></view>
<view>{{(shopTableInfo.seatNum*storeInfo.tableFee).toFixed(2)}}</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"/>
@@ -221,7 +228,6 @@
shopId: null,
storeInfo: {},
tableCode: null,
dinersNum: null,
}
},
computed: {
@@ -245,12 +251,11 @@
onLoad(e) {
console.log(e)
this.storeInfo = JSON.parse(decodeURIComponent(e.storeInfo));
this.shopId =this.storeInfo.shopId;
this.shopId = this.storeInfo.id;
this.listinfo.name = this.storeInfo.shopName;
this.listinfo.details = JSON.parse(e.cartLists).data;
this.listinfo.payAmount = JSON.parse(e.cartLists).amount;
if ( e.tableCode ) { this.tableCode = e.tableCode;}
if ( e.dinersNum ) { this.dinersNum = e.dinersNum;}
if ( this.storeInfo.eatModel.indexOf("dine-in") != -1 ) {
this.eatModel = "dine-in";
@@ -308,6 +313,7 @@
lat: uni.cache.get('getLocationstorage').lat ? uni.cache.get('getLocationstorage').lat :
'',
}
console.log(this.shopId)
if (this.tableCode) {params.code = this.tableCode}
if (this.shopId) {params.shopId = this.shopId}
let res = await this.api.productqueryShop(params)
@@ -428,7 +434,7 @@
type: this.is_type,
}
if ( this.eatModel == "dine-in" && this.tableCode ) { params.tableId = this.tableCode; }
if ( this.dinersNum ) { params.num = this.dinersNum; }
if ( this.shopTableInfo && this.shopTableInfo.seatNum ) { params.num = this.shopTableInfo.seatNum; }
let res = await this.api.choseEatModel(params)
this.listinfo.details = res.data.info;
this.listinfo.payAmount = res.data.amount;
@@ -546,8 +552,14 @@
"remark": this.remark,
})
console.log(res)
this.listinfoid = res.data.id
this.showpopupclickdd();
this.listinfoid = res.data.id;
if ( this.storeInfo.registerType == 'restaurant') {
uni.redirectTo({
url: '/pagesOrder/order_detail/index?orderId=' + this.listinfoid
});
} else {
this.showpopupclickdd();
}
},
/**
@@ -594,11 +606,11 @@
},
/**
* 微信支付
* 微信/支付宝支付
*/
async showpopupclickdds() {
let res = await this.api.payorderPay({
let res = await this.api.orderPay({
orderId: this.listinfoid,
// #ifdef MP-WEIXIN
payType: 'wechatPay',
@@ -610,9 +622,9 @@
}) //判断是否支付成功
if (res.code == 0) {
// #ifdef MP-WEIXIN
// 微信支付还是余额支付
uni.requestPayment({
// #ifdef MP-WEIXIN
provider: 'wxpay', //支付类型-固定值
partnerid: res.data.appId, // 微信支付商户号
timeStamp: res.data.timeStamp, // 时间戳(单位:秒)
@@ -620,61 +632,49 @@
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: "支付成功"
})
// #ifdef MP-WEIXIN
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
url: '/pagesOrder/order_detail/index?orderId=' + _this.listinfoid
});
},
})
},
fail: () => {
uni.pro.navigateTo('/pagesOrder/order_detail/index', {
orderId: this.listinfoid
})
uni.hideLoading()
}
});
// #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
// },
// })
// #endif
// #ifdef MP-ALIPAY
_this.paymodfiyOrderInfo()
uni.redirectTo({
url: '/pagesOrder/order_detail/index?orderId=' + _this.listinfoid
});
// #endif
},
fail: () => {
fail: async () => {
let res = await this.api.cancelOrderPay({
orderId: this.listinfoid,
}) //判断是否支付成功
uni.pro.navigateTo('/pagesOrder/order_detail/index', {
orderId: this.listinfoid
})
uni.hideLoading()
}
});
// #endif
uni.hideLoading()
}
},
@@ -1135,6 +1135,34 @@
}
}
.cell-item{
display: flex;
align-items: center;
justify-content: space-between;
padding: 32rpx 34rpx 32rpx 34rpx;
.label{
font-weight: bold;
font-size: 32rpx;
color: #333333;
}
.val{
display: flex;
align-items: flex-end;
view:nth-child(1){
font-weight: 400;
font-size: 24rpx;
color: #999999;
margin-right: 42rpx;
}
view:nth-child(2){
display: flex;
align-items: flex-end;
font-weight: bold;
font-size: 36rpx;
color: #333333;
}
}
}
.totalPrice{
padding: 32rpx 30rpx;
box-sizing: border-box;
@@ -1269,15 +1297,12 @@
}
}
.paymentBtnText{
width: 216rpx;
height: 76rpx;
line-height: 76rpx;
background: #E8AD7B;
border-radius: 36rpx 36rpx 36rpx 36rpx;
border-radius: 36rpx;
font-weight: 400;
font-size: 32rpx;
color: #FFFFFF;
text-align: center;
padding: 14rpx 44rpx;
}
}
.page-total{

View File

@@ -90,9 +90,9 @@
shopId: this.shopId,
}) //判断是否支付成功
if ( res.code == 0) {
uni.pro.navigateTo('order_food/order_food', {
uni.pro.redirectTo('order_food/order_food', {
// uni.pro.navigateTo('order_food/order_food', {
tableCode: this.tableCode,
dinersNum: this.dinersNum,
})
}

View File

@@ -1,559 +0,0 @@
<template>
<view class="container">
<view class="card_box">
<view class="card_head_box">
<view class="card_head_item"></view>
<view class="card_head_item"></view>
<view class="card_head_item"></view>
<view class="card_head_item"></view>
<view class="card_head_item"></view>
<view class="card_head_item"></view>
<view class="card_head_item"></view>
<view class="card_head_item"></view>
</view>
<view class="card">
<!-- 订单头部 -->
<view class="head">
<view class="head_left">
<text class="shopName">{{listinfo.name}}</text>
<text class="tableName" v-if="listinfo.tableName">桌号{{listinfo.tableName}}</text>
</view>
<text class="status" v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'">
<text> 待支付 </text>
</text>
<text class="status" v-if="listinfo.status == 'unsend'">
<text>待发货</text>
</text>
<text class="status" v-if="listinfo.status == 'closed'">
<text>订单完成</text>
</text>
<text class="status" v-if="listinfo.status == 'send'">
<text> 已发</text>
</text>
<text class="status" v-if="listinfo.status == 'refunding'">
<text>申请退单</text>
</text>
<text class="status" v-if="listinfo.status == 'refund'">
<text>退单</text>
</text>
<text class="status" v-if="listinfo.status == 'cancelled'">
<text>已取消</text>
</text>
<text class="status" v-if="listinfo.status == 'merge'">
<text>合台</text>
</text>
</view>
<!-- 取餐号 -->
<view class="number-wrap"
v-if="listinfo.status != 'unpaid' && listinfo.status != 'paying'&& listinfo.status != 'cancelled'">
<text class="t">取餐号</text>
<text class="number">{{listinfo.outNumber}}</text>
</view>
<!-- 订单详情 -->
<view class="shop-box">
<view class="shop-head">
<view class="shop-head-left">
<view class="tag-wrap">
<text class="tag" v-if="listinfo.sendType == 'post'">快递</text>
<text class="tag" v-if="listinfo.sendType == 'takeaway'">外卖</text>
<text class="tag" v-if="listinfo.sendType == 'takeself'">自提</text>
<text class="tag" v-if="listinfo.sendType == 'table'">堂食</text>
</view>
<text class="title">订单详情</text>
</view>
<view style="display: flex;align-items: center;"
v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'"
>
<!-- <text style="font-size:24rpx;">支付时间:</text> -->
<uni-countdown :show-day="false" color="#E3AD7F" border-color="#E3AD7F" splitorColor="#E3AD7F"
:font-size="16" :hour="0" :minute="listinfo.expiredMinutes" :second="listinfo.expiredSeconds" />
</view>
</view>
<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>
</view>
<view class="info">
<text class="productName">{{item.productName}}</text>
<text class="productSkuName" v-if="item.productSkuName">{{item.productSkuName}}</text>
</view>
<view class="price">
<view class="priceAmount">{{item.priceAmount}}</view>
<view class="num">x{{item.num}}</view>
</view>
</view>
</view>
<view class="total-wrap">
<view>合计</view>
<view class="price"> {{listinfo.payAmount}} </view>
</view>
</view>
<!-- 订单信息 -->
<view class="order_footer">
<view class="order_footer_icon">
<view class="order_footer_left_icon"></view>
<view class="order_footer_right_icon"></view>
</view>
<view class="title">订单信息</view>
<view class="order-info">
<view class="row" @click="copyHandle(listinfo.orderNo)">
<text class="t">订单信息</text>
<text class="info">{{listinfo.orderNo}}点击复制</text>
</view>
<view class="row">
<text class="t">创建时间</text>
<text class="info">{{$u.timeFormat(listinfo.time, 'yyyy-mm-dd hh:MM:ss')}}</text>
</view>
</view>
</view>
</view>
</view>
<view class="fixedview">
<view class="flex-between" v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'">
<view class="fixedview_one flex-start">
<view class="fixedview_oneone"> 实付金额 </view>
<view class="fixedview_onetow">
<text>¥</text>{{listinfo.payAmount}}
</view>
</view>
<view class="fixedview_tow" @tap="$u.debounce(showpopupclick,1000)">
立即付款
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
pay_type: 1,
orderId: '',
listinfo: {},
srcimge: 'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/wx.jpg'
};
},
async onLoad(e) {
console.log(e)
this.orderId = e.orderId
},
onShow() {
this.orderorderInfo()
},
onUnload() {
uni.switchTab({
url: '/pages/order/order'
})
},
methods: {
/**
* 获取订单信息
*/
async orderorderInfo() {
let res = await this.api.orderorderInfo({
orderId: this.orderId
})
if (res.code == 0) {
this.listinfo = res.data;
}
},
/**
* 支付完成后请求
*/
async paymodfiyOrderInfo() {
let res = await this.api.paymodfiyOrderInfo({
orderId: this.listinfo.orderId,
})
},
/**
* 立即付款
*/
async showpopupclick() {
let res = await this.api.payorderPay({
orderId: this.orderId,
}) //判断是否支付成功
if (res.code == 0) {
uni.showLoading({
title: '加载中',
mask: true
})
// #ifdef MP-WEIXIN
uni.requestPayment({
provider: 'wxpay', //支付类型-固定值
partnerid: res.data.appId, // 微信支付商户号
timeStamp: res.data.timeStamp, // 时间戳(单位:秒)
nonceStr: res.data.nonceStr, // 随机字符串
package: res.data.package, // 固定值
signType: res.data.signType, //固定值
paySign: res.data.paySign, //签名
success: (res) => {
uni.showToast({
title: "支付成功"
})
setTimeout(res => {
uni.hideLoading()
uni.switchTab({
url: '/pages/order/order'
});
}, 500)
this.paymodfiyOrderInfo()
},
fail: (err) => {
uni.showToast({
icon: 'none',
title: '支付失败'
})
setTimeout(res => {
uni.hideLoading()
uni.switchTab({
url: '/pages/order/order'
});
}, 500)
}
});
// #endif
}
},
/**
* 复制订单号
* @param {Object} e
*/
copyHandle(e) {
uni.setClipboardData({
data: e,
success() {
uni.showToast({
title: '复制成功',
icon: 'none'
});
}
});
},
},
};
</script>
<style scoped lang="scss">
page{
background-color: #F7F7F7;
}
.container {
padding: 32rpx 28rpx 194rpx 28rpx;
}
.card_box{
background-color: #fff;
// box-shadow: 0rpx 8rpx 12rpx 2rpx rgba(87,86,86,0.35);
position: relative;
width: 100%;
height: 100%;
box-shadow: 0rpx 4rpx 12rpx 2rpx rgba(87,86,86,0.35);
border-radius: 18rpx;
.card_head_box{
width: 100%;
display: flex;
justify-content: space-between;
position: absolute;
top: -22.5rpx;
padding: 0 44rpx;
.card_head_item{
width: 45rpx;
height: 45rpx;
background-color: #f9f9f9;
border-radius: 50%;
box-shadow: inset 0rpx -13rpx 18rpx -16rpx rgba(87, 86, 86, 0.35);
}
}
}
.card {
// background-color: #fff;
border-radius: 20upx;
margin-bottom: 28upx;
position: relative;
.head {
display: flex;
justify-content: space-between;
padding: 50rpx 34rpx 32rpx 34rpx;
border-bottom: 2rpx dashed #E3E3E3;
.head_left{
.shopName{
font-weight: bold;
font-size: 32rpx;
color: #333333;
}
.tableName{
font-weight: 400;
font-size: 28rpx;
color: #333333;
}
}
.status {
text{
font-weight: 500;
font-size: 28rpx;
color: #333333;
}
}
}
.number-wrap {
display: flex;
flex-direction: column;
align-items: center;
margin-top: 32rpx;
.t{
font-weight: 400;
font-size: 28rpx;
color: #333333;
}
.number {
font-weight: bold;
font-size: 56rpx;
color: #333333;
}
}
.price {
.i {
font-size: 20upx;
}
.num {
font-size: 38upx;
}
}
.shop-box{
padding: 36rpx 34rpx 30rpx 34rpx;
border-bottom: 2rpx dashed #E3E3E3;
.shop-head{
display: flex;
justify-content: space-between;
align-items: center;
.shop-head-left{
display: flex;
align-items: center;
.tag-wrap{
width: 80rpx;
height: 48rpx;
background: #FFFFFF;
border-radius: 10rpx 10rpx 10rpx 10rpx;
border: 2rpx solid #E3AD7F;
margin-right: 18rpx;
display: flex;
align-items: center;
justify-content: center;
.tag{
font-weight: 400;
font-size: 24rpx;
color: #E3AD7F;
}
}
.title{
font-weight: bold;
font-size: 28rpx;
color: #333333;
}
}
}
.shop-info {
margin-top: 32rpx;
.item:nth-child(1) {
margin-top: 0;
}
.item {
margin-bottom: 32rpx;
display: flex;
.cover{
}
.info {
flex: 1;
display: flex;
flex-direction: column;
padding-left: 16upx;
.productName{
font-weight: bold;
font-size: 28rpx;
color: #333333;
margin-top: 20rpx;
}
.productSkuName{
font-weight: 400;
font-size: 24rpx;
color: #999999;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
overflow: hidden;
text-overflow: ellipsis;
}
.n {
font-size: 24upx;
color: #999;
}
}
.price{
display: flex;
flex-direction: column;
align-items: flex-end;
padding-left: 68rpx;
.priceAmount{
font-weight: 500;
font-size: 28rpx;
color: #333333;
margin-top: 26rpx;
}
.num{
font-weight: 400;
font-size: 24rpx;
color: #999999;
margin-top: 22rpx;
}
}
}
}
.total-wrap {
width: 100%;
display: flex;
justify-content: space-between;
font-weight: 500;
font-size: 28rpx;
.price{
font-weight: bold;
font-size: 32rpx;
}
}
}
.order_footer{
display: flex;
flex-direction: column;
padding: 34rpx;
position: relative;
.order_footer_icon{
width: 100%;
position: absolute;
top: -22.5rpx;
left: 0;
display: flex;
justify-content: space-between;
.order_footer_left_icon{
width: 45rpx;
height: 45rpx;
margin-left: -22.5rpx;
background-color: #f9f9f9;
border-radius: 50%;
box-shadow: inset -20rpx 0rpx 22rpx -20rpx rgba(87, 86, 86, 0.35);
}
.order_footer_right_icon{
width: 45rpx;
height: 45rpx;
margin-right: -22.5rpx;
background-color: #f9f9f9;
border-radius: 50%;
box-shadow: inset 13rpx 0rpx 16rpx -9rpx rgba(87, 86, 86, 0.35);
}
}
.title{
font-weight: bold;
font-size: 28rpx;
color: #333333;
}
.order-info {
.row {
display: flex;
justify-content: space-between;
padding-top: 32upx;
.t {
font-weight: normal;
font-size: 28rpx;
color: #333333;
}
.info {
font-weight: 400;
font-size: 24rpx;
color: #666666;
}
}
}
}
}
.fixedview {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
.flex-between {
width: 100%;
padding: 36rpx 54rpx 102rpx 54rpx;
background: #FFFFFF;
.fixedview_one {
display: flex;
align-items: flex-end;
.fixedview_oneone {
font-weight: 400;
font-size: 28rpx;
color: #666666;
}
.fixedview_onetow {
font-weight: bold;
font-size: 32rpx;
color: #333333;
text {
font-size: 24rpx;
}
}
}
.fixedview_tow {
width: 140rpx;
height: 56rpx;
line-height: 56rpx;
text-align: center;
background: #E3AD7F;
border-radius: 12rpx 12rpx 12rpx 12rpx;
font-weight: 400;
font-size: 28rpx;
color: #FFFFFF;
}
}
}
</style>

View File

@@ -1,5 +1,27 @@
<template>
<view class="container">
<view class="headStatus" v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'||listinfo.status=='closed'">
<view class="status">
<u-icon name="checkmark-circle-fill" color="#03C061" size="46"></u-icon>
<view class="statusName" v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'">下单成功</view>
<view class="statusName" v-if="listinfo.status=='closed'">已完成</view>
</view>
<view class="time" v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'">下单时间{{listinfo.createdAt}}</view>
<view class="time" v-if="listinfo.status=='closed'">付款时间{{listinfo.paidTime}}</view>
</view>
<view class="wxQrcode" v-if="listinfo.shopQrcode">
<view class="left">
<text class="title">扫码加好友优惠多多</text>
<text>优惠活动多</text>
<text>充值有好礼</text>
<text>会员享低价</text>
<text>长按保存微信内扫一扫加好友</text>
</view>
<u-image width="152" height="152" radius="16" :src="listinfo.shopQrcode" ></u-image>
</view>
<orderInfoAfter ref="orderInfoAfter" :listinfo="listinfo" v-if="listinfo.useType == 'dine-in-after'"></orderInfoAfter>
<orderInfoBefore ref="orderInfoBefore" :listinfo="listinfo" v-else></orderInfoBefore>
@@ -64,13 +86,12 @@
srcimge: 'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/wx.jpg'
};
},
async onLoad(e) {
onLoad(e) {
console.log(e)
this.orderId = e.orderId
},
onShow() {
this.orderorderInfo()
this.getAount();
},
onUnload() {
this.ispws = false
@@ -78,6 +99,12 @@
url: '/pages/order/order'
})
},
onNavigationBarButtonTap ( e ) {
console.log(e)
},
onBackPress ( e ) {
console.log(e)
},
methods: {
/**
@@ -85,7 +112,7 @@
*/
async getAount() {
let res = await this.api.shopUserInfo({
"shopId": uni.cache.get('shopId'),
"shopId": this.shopId,
"userId": uni.cache.get('userInfo').id,
})
if (res.code == 0) {
@@ -108,10 +135,11 @@
if (res.code == 0) {
this.listinfo = res.data;
this.listinfoid = res.data.orderId;
uni.cache.set('shopId',res.data.shopId)
this.shopId = res.data.shopId;
if (this.listinfo.useType == " ") {
//堂食先付费
}
this.getAount();
}
},
@@ -223,7 +251,7 @@
* 微信支付
*/
async wechatPay() {
let res = await this.api.payorderPay({
let res = await this.api.orderPay({
orderId: this.orderId,
// #ifdef MP-WEIXIN
payType: 'wechatPay',
@@ -237,8 +265,8 @@
title: '加载中',
mask: true
})
// #ifdef MP-WEIXIN
uni.requestPayment({
// #ifdef MP-WEIXIN
provider: 'wxpay', //支付类型-固定值
partnerid: res.data.appId, // 微信支付商户号
timeStamp: res.data.timeStamp, // 时间戳(单位:秒)
@@ -246,14 +274,21 @@
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: "支付成功"
})
// #ifdef MP-WEIXIN
uni.requestSubscribeMessage({
tmplIds: ['z0fUG7-jhSfYCrw6poOvSRzh4_hgnPkm_5C7E5s5bCQ'],
complete() {
uni.showToast({
title: "支付成功"
})
this.paymodfiyOrderInfo()
setTimeout(res => {
uni.hideLoading()
@@ -263,8 +298,19 @@
}, 500)
},
})
// #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: this.orderId,
}) //判断是否支付成功
uni.showToast({
icon: 'none',
title: '支付失败'
@@ -278,35 +324,7 @@
}
});
// #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
}
},
@@ -347,7 +365,51 @@
.container {
padding: 32rpx 28rpx 224rpx 28rpx;
}
.headStatus{
display: flex;
flex-direction: column;
margin-bottom: 32rpx;
align-items: center;
.status{
display: flex;
align-items: center;
justify-content: center;
font-weight: bold;
font-size: 36rpx;
color: #333333;
.statusName{
margin-left: 16rpx;
}
}
.time{
font-weight: 400;
font-size: 24rpx;
color: #999999;
margin-top: 18rpx;
}
}
.wxQrcode{
background: #FFFFFF;
border-radius: 18rpx 18rpx 18rpx 18rpx;
padding: 32rpx 24rpx;
font-weight: 400;
font-size: 24rpx;
color: #999999;
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 32rpx;
.left{
display: flex;
flex-direction: column;
}
.title{
font-weight: bold;
font-size: 28rpx;
color: #333333;
margin-bottom: 16rpx;
}
}
.card_box{
background-color: #fff;
// box-shadow: 0rpx 8rpx 12rpx 2rpx rgba(87,86,86,0.35);
@@ -700,15 +762,12 @@
}
.fixedview_tow {
width: 140rpx;
height: 56rpx;
line-height: 56rpx;
text-align: center;
background: #E3AD7F;
border-radius: 12rpx 12rpx 12rpx 12rpx;
border-radius: 36rpx;
font-weight: 400;
font-size: 28rpx;
font-size: 32rpx;
color: #FFFFFF;
padding: 14rpx 44rpx;
}
}
}