订单逻辑修改

This commit is contained in:
GaoHao
2024-09-26 09:20:08 +08:00
parent 5f03e44701
commit 1de598f1b1
16 changed files with 856 additions and 135 deletions

49
App.vue
View File

@@ -14,7 +14,9 @@
uni.cache.set('menuInfo', uni.getMenuButtonBoundingClientRect());
// #endif
uni.cache.set('NAME', '零点八零');
// this.$store.dispatch("loginEvent")
if (!uni.cache.get('token')) {
this.$store.dispatch("loginEvent")
}
},
onLoad() {
@@ -66,50 +68,7 @@
// console.log('App Hide');
},
methods: {
userlogin() {
if (!uni.cache.get('token')) {
// this.$store.dispatch("loginEvent"); //获取shapid
uni.login({
// #ifndef MP-WEIXIN
provider: 'weixin',
// #endif
// #ifndef MP-ALIPAY
provider: 'alipay',
// #endif
success: (data) => {
uni.getUserInfo({
// #ifndef MP-WEIXIN
provider: 'weixin',
// #endif
// #ifndef MP-ALIPAY
provider: 'alipay',
// #endif
success: async (infoRes) => {
console.log(infoRes)
let res = await Api.userwxlogin({
code: data.code, //临时登录凭证
rawData: infoRes.rawData,
// #ifdef MP-WEIXIN
source: 'wechat',
// #endif
// #ifdef MP-ALIPAY
source: 'alipay',
// #endif
})
if (res.code == 0) {
uni.cache.set('token', res.data.token);
uni.cache.set('miniAppOpenId', res.data.userInfo
.miniAppOpenId)
uni.cache.set('userInfo', res.data.userInfo);
this.$isResolve()
}
},
fail: (err) => {}
});
},
})
}
}
}
};
</script>

View File

@@ -6,6 +6,7 @@ export default {
return uni.api.get("/login/userInfo", data,false);
},
userwxlogins(data) { // 获取手机号
console.log(data)
return uni.api.post("/login/getPhoneNumber", data);
},
getShopExtend(data) { //获取图片 通过shopId和autokey

View File

@@ -273,19 +273,19 @@ const getUserInfo = function (successCallback, failCallback) {
success: (data) => {
console.log(data)
// 支付宝小程序环境
// my.getAuthUserInfo({
// success: async (infoRes) => {
// let res = await Api.userwxlogin({
// code: data.authCode, //临时登录凭证
// rawData: JSON.stringify(infoRes),
// source: 'alipay'
// })
// if (res.code == 0) {
// resolve(res)
// }
// },
// fail: (err) => {}
// });
my.getAuthUserInfo({
success: async (infoRes) => {
let res = await Api.userwxlogin({
code: data.authCode, //临时登录凭证
rawData: JSON.stringify(infoRes),
source: 'alipay'
})
if (res.code == 0) {
resolve(res)
}
},
fail: (err) => {}
});
}
});
})

View File

@@ -54,13 +54,27 @@
}
// #ifdef APP || MP-WEIXIN || MP-ALIPAY
uni.scanCode({
success: (res) => {
success: async(res) => {
let tableCode = this.getQueryString(decodeURIComponent(res.result), 'code')
uni.cache.set('tableCode', tableCode)
if (tableCode) {
uni.pro.navigateTo('order_food/order_food', {
tableCode: tableCode,
let data = await this.api.productqueryShop({
code: uni.cache.get('tableCode'),
lng: uni.cache.get('getLocationstorage').lng ? uni.cache.get('getLocationstorage').lng :
'',
lat: uni.cache.get('getLocationstorage').lat ? uni.cache.get('getLocationstorage').lat :
'',
})
if ( !data.data.shopTableInfo.orderId && data.data.storeInfo.isTableFee == 1) {
uni.pro.navigateTo('/pagesOrder/orderAMeal/index', {
tableCode: tableCode,
})
} else {
uni.pro.navigateTo('order_food/order_food', {
tableCode: tableCode,
})
}
}
},
fail:( res) =>{

View File

@@ -64,14 +64,28 @@
uni.cache.set('forceUpdate',2)
},200)
uni.scanCode({
success: (res) => {
success: async (res) => {
let tableCode = this.getQueryString(decodeURIComponent(res.result), 'code')
uni.cache.set('tableCode', tableCode)
if (tableCode) {
uni.pro.navigateTo('order_food/order_food', {
tableCode: tableCode,
let data = await this.api.productqueryShop({
code: uni.cache.get('tableCode'),
lng: uni.cache.get('getLocationstorage').lng ? uni.cache.get('getLocationstorage').lng :
'',
lat: uni.cache.get('getLocationstorage').lat ? uni.cache.get('getLocationstorage').lat :
'',
})
// uni.pro.navigateTo('/pagesOrder/orderAMeal/index')
console.log()
if ( !data.data.shopTableInfo.orderId && data.data.storeInfo.isTableFee == 1) {
uni.pro.navigateTo('/pagesOrder/orderAMeal/index', {
tableCode: tableCode,
})
} else {
uni.pro.navigateTo('order_food/order_food', {
tableCode: tableCode,
})
}
}
},
fail: () => {

View File

@@ -207,6 +207,7 @@
code: data.code,
encryptedData: d.detail.encryptedData,
iv: d.detail.iv,
source: "wechar"
})
this.telephone = res.data
}
@@ -223,9 +224,30 @@
success: async (data) => {
console.log(data)
let res = await this.api.userwxlogins({
code: res.authCode,
encryptedData: d.response,
iv: d.detail.iv,
encryptedData: JSON.parse(data.response).response,
source: "alipay"
})
this.phonetitle = res.data.substr(0, 3) + "****" + res.data.substr(7)
this.mobile = res.data;
}
});
}
});
// #endif
// #ifdef MP-ALIPAY
// 支付宝小程序环境
my.getAuthCode({
scopes: 'auth_user',
success: (res) => {
console.log(res)
let authCode = res.authCode;
my.getPhoneNumber({
success: async (data) => {
let res = await this.api.userwxlogins({
// code: authCode,
encryptedData: JSON.parse(data.response).response,
source: "alipay"
})
this.phonetitle = res.data.substr(0, 3) + "****" + res.data.substr(7)
this.mobile = res.data;

View File

@@ -109,8 +109,11 @@
type: 'index',
})
} else {
uni.pro.navigateTo('member/memberdetails', {
shopId_id: item.shopId
// uni.pro.navigateTo('member/memberdetails', {
// shopId: item.shopId
// })
uni.pro.navigateTo('/pages/order_food/order_food', {
shopId: item.shopId
})
}
}

View File

@@ -131,7 +131,7 @@
itemClick ( type ) {
if ( type == 1) {
uni.pro.navigateTo('member/index', {
shopId: this.shopUserInfo.id,
shopId: this.shopId,
type: 'index',
})
} else if ( type == 3 ) {

View File

@@ -227,7 +227,7 @@
</view>
</view>
<view class="placedOrderTip"><u-avatar :src="src" shape="circle"></u-avatar><view style="margin-left: 8rpx;">已下单菜品</view></view>
<view class="placedOrderTip" @click="placedOrder" v-if="tableCode&&shopInfo.shopTableInfo.orderId&&shopInfo.storeInfo.registerType == 'restaurant'"><u-avatar :src="src" shape="circle"></u-avatar><view style="margin-left: 8rpx;">已下单菜品</view></view>
<!-- 购物车 -->
<u-popup :show="showCart" :round="20" :safeAreaInsetBottom="false" :zIndex="98" :overlayStyle="{ zIndex: 98 }"
@@ -441,6 +441,7 @@
shopExtend: null,
shopId: null,
tableCode: null,
dinersNum: null,
}
},
onPageScroll(e) {
@@ -475,9 +476,15 @@
this.tableCode = this.getQueryString(decodeURIComponent(e.q), 'code')
uni.cache.set('tableCode', this.tableCode)
}
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) {
@@ -534,7 +541,7 @@
handlemessage() {
this.socketTicket ? this.socketTicket.Close() : null //调用前先判断是否有socket正在进行 先关闭后链接
this.socketTicket = new webSocketUtils(`${uni.conf.baseUrlwws}`, 5000, {
tableId: uni.cache.get('tableCode'),
tableId: this.tableCode,
shopId: this.shopId,
userId: uni.cache.get('userInfo').id,
"type": "connect",
@@ -587,7 +594,8 @@
*/
async productqueryShop() {
let res = await this.api.productqueryShop({
code: uni.cache.get('tableCode'),
code: this.tableCode,
shopId: this.shopId,
lng: uni.cache.get('getLocationstorage').lng ? uni.cache.get('getLocationstorage').lng :
'',
lat: uni.cache.get('getLocationstorage').lat ? uni.cache.get('getLocationstorage').lat :
@@ -639,11 +647,19 @@
searchStatus (e) {
if ( e == "searchClick" ) {
uni.navigateTo({
url: '/pages/order_food/order_food_search?tableCode=' + uni.cache.get('tableCode')
url: `/pages/order_food/order_food_search?tableCode=${this.tableCode}&shopId=${this.shopId}`
});
}
},
/**
* 查看已下单菜品
*/
placedOrder () {
uni.pro.navigateTo('/pagesOrder/order_detail/index', {
orderId: this.shopInfo.shopTableInfo.orderId,
})
},
/**
* 商品数量增加/减少
* @param {Object} item
@@ -731,7 +747,7 @@
"productId": item.id, //商品id
"shopId": this.shopId,
"userId": uni.cache.get('userInfo').id,
"tableId": uni.cache.get('tableCode'),
"tableId": this.tableCode,
}
this.addCart(params)
},
@@ -755,7 +771,7 @@
"productId": item.productId, //商品id
"shopId": this.shopId,
"userId": uni.cache.get('userInfo').id,
"tableId": uni.cache.get('tableCode'),
"tableId": this.tableCode,
}
this.addCart(params);
} catch (e) {
@@ -782,7 +798,7 @@
async cartclear() {
let res = await this.api.cleanCart({
"shopId": this.shopId,
"tableId": uni.cache.get('tableCode'),
"tableId": this.tableCode,
})
},
@@ -1001,7 +1017,7 @@
try {
// console.log(this.skuidname.join(","))
let res = await this.api.productqueryProductSku({
code: uni.cache.get('tableCode'),
code: this.tableCode,
shopId: this.shopId,
productId: item.id, //商品id
isVip: item.isVip, //商品id
@@ -1018,7 +1034,7 @@
"isVip": item.isVip,
"shopId": this.shopId,
"userId": uni.cache.get('userInfo').id,
"tableId": uni.cache.get('tableCode'),
"tableId": this.tableCode,
}
this.addCart(params);
} else {
@@ -1055,9 +1071,8 @@
})
return false
}
console.log(JSON.stringify(this.shopInfo.storeInfo))
uni.navigateTo({
url: `/pagesOrder/confirm_order/index?storeInfo=${encodeURIComponent(JSON.stringify(this.shopInfo.storeInfo))}&cartLists=${JSON.stringify(this.cartLists)}&tableCode=${this.tableCode}`
url: `/pagesOrder/confirm_order/index?storeInfo=${encodeURIComponent(JSON.stringify(this.shopInfo.storeInfo))}&cartLists=${JSON.stringify(this.cartLists)}&tableCode=${this.tableCode||''}&dinersNum=${this.dinersNum||''}`
});
},

View File

@@ -279,6 +279,8 @@
searchList: [],
systemInfo: getApp().globalData.systemInfo,
shopId: null,
}
},
onPageScroll(e) {
@@ -292,7 +294,9 @@
},
onLoad(e) {
if ( e.shopId ) {
this.shopId = e.shopId
}
},
onUnload() {
if (this.socketTicket) {
@@ -337,6 +341,7 @@
async productqueryShop() {
let res = await this.api.productqueryShop({
code: uni.cache.get('tableCode'),
shopId: this.shopId,
lng: uni.cache.get('getLocationstorage').lng ? uni.cache.get('getLocationstorage').lng :
'',
lat: uni.cache.get('getLocationstorage').lat ? uni.cache.get('getLocationstorage').lat :

View File

@@ -181,7 +181,7 @@
* 获取手机号
* @param {Object} d
*/
getPhone(d) {
async getPhone(d) {
console.log(d)
// #ifdef MP-WEIXIN
if (d.detail.iv) {
@@ -194,6 +194,7 @@
code: data.code,
encryptedData: d.detail.encryptedData,
iv: d.detail.iv,
source: "wechar"
})
this.phonetitle = res.data.substr(0, 3) + "****" + res.data.substr(7)
this.mobile = res.data;
@@ -207,13 +208,13 @@
scopes: 'auth_user',
success: (res) => {
console.log(res)
let authCode = res.authCode;
my.getPhoneNumber({
success: async (data) => {
console.log(data)
let res = await this.api.userwxlogins({
code: res.authCode,
encryptedData: d.response,
iv: d.detail.iv,
// code: authCode,
encryptedData: JSON.parse(data.response).response,
source: "alipay"
})
this.phonetitle = res.data.substr(0, 3) + "****" + res.data.substr(7)
this.mobile = res.data;
@@ -221,9 +222,6 @@
});
}
});
// #endif
},

View File

@@ -155,7 +155,7 @@
if (uni.cache.get('shopId') && uni.cache.get('token')) {
if ( this.shopInfo.isVip == 0 ) {
uni.pro.navigateTo('member/memberdetails', {
shopId_id: uni.cache.get('shopId')
shopId: uni.cache.get('shopId')
})
} else {
uni.navigateTo({

View File

@@ -1,5 +1,5 @@
<template>
<view>
<view class="container">
<!-- 占位符导航栏 -->
<!-- <navseat class="navbar" :opacity='opacitys' :backColor="'#E8AD7B'" :title='toplist.name' :titleshow='true'></navseat> -->
<!-- #ifdef MP-WEIXIN -->
@@ -9,14 +9,14 @@
<!-- 头部内容 -->
<view class="head">
<view class="head_bg"></view>
<view class="tips">
<view class="tips" v-if="storeInfo.registerType == 'munchies'">
<image class="informIcon" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/informIcon.png" mode="aspectFill"/>
<text class="informText">温馨提示请适量点餐避免浪费</text>
</view>
<view class="tabBox">
<view class="tabBox" v-if="storeInfo.registerType == 'munchies'">
<view class="tab">
<view :class="is_type==(index+1)?'tab_item'+is_type+' tab_item active ':'tab_item'" v-for="(item,index) in is_typeList" :key="index" @click="tabClick(index+1)">
<view :class="is_type==(index+1)?'tab_item'+is_type+' tab_item active ':'tab_item'" v-for="(item,index) in is_typeList" :key="index" @click="tabClick(index+1,item.val)">
<view></view>
<image class="icon" :src="is_type==(index+1)?item.url_active:item.url" mode="aspectFill"/>
<text class="title" :class="{active:is_type==(index+1)}">{{item.title}}</text>
@@ -48,13 +48,15 @@
</view>
</view>
<view class="addDish" @click="addDish">加菜下单</view>
<view class="addDish" @click="addDish" v-if="storeInfo.registerType == 'restaurant'">加菜下单</view>
<view class="tabBox_t ">
<view class="tabBox_t " v-if="storeInfo.registerType == 'restaurant'">
<view class="shopName">{{ listinfo.name }}</view>
<view class="tableName">
<view>桌号</view>
<view class="name">{{ shopTableInfo.name }} </view><view></view></view>
<view class="name">{{ shopTableInfo.name }} </view>
<view class="num" v-if="dinersNum">{{ dinersNum }}</view>
</view>
</view>
</view>
<!-- 订单内容区域 -->
@@ -95,7 +97,7 @@
</view>
<!-- 支付方式 -->
<view class="paymentMethod">
<view class="paymentMethod" v-if="storeInfo.registerType == 'munchies'">
<view class="paymentMethod_content">
<view class="paymentMethod_title">支付方式</view>
<u-radio-group v-model="radiovalue" iconPlacement="right" @change="groupChange" :size="28"
@@ -128,9 +130,13 @@
<text style="margin-bottom: 5rpx;">实付金额</text>
<text class="totalAmount">{{ listinfo.payAmount }} </text>
</view>
<view class="paymentBtnText" @tap="$u.debounce(showpopupclickdd, 500)" v-if="listinfoid && listinfo"> {{ paymentBtnText }} </view>
<view class="paymentBtnText" @tap="$u.debounce(orderdetail, 500)" v-else> {{ paymentBtnText }} </view>
<!-- <view class="paymentBtnText" @tap="$u.debounce(orderdetail, 500)" > 提交订单 </view> -->
<block v-if="storeInfo.registerType == 'munchies'">
<view class="paymentBtnText" @tap="$u.debounce(showpopupclickdd, 500)" v-if="listinfoid && listinfo"> {{ paymentBtnText }} </view>
<view class="paymentBtnText" @tap="$u.debounce(orderdetail, 500)" v-else> {{ paymentBtnText }} </view>
</block>
<block v-if="storeInfo.registerType == 'restaurant'">
<view class="paymentBtnText" @tap="$u.debounce(orderdetail, 500)" > 提交订单 </view>
</block>
</view>
<u-popup :show="ispws" :round="20" mode="bottom" @close="ispws = false" height="500" :safeAreaInsetBottom="false">
@@ -174,9 +180,10 @@
},
is_type: 1,
is_typeList: [
{ title: "送餐到桌", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/tab1.png" , url_active: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/tab1_active.png"},
{ title: "打包外带", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/tab2.png" , url_active: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/tab2_active.png"},
{ title: "送餐到桌", val: "dine-in", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/tab1.png" , url_active: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/tab1_active.png"},
{ title: "打包外带", val: "take-out", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/tab2.png" , url_active: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/tab2_active.png"},
],
eatModel: [],
favorable: [
{ name: "优惠券", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/coupon.png"},
{ name: "团购优惠", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/groupOffer.png"},
@@ -213,8 +220,9 @@
socketTicket: null,
shopId: null,
storeInfo: null,
storeInfo: {},
tableCode: null,
dinersNum: null,
}
},
computed: {
@@ -238,12 +246,19 @@
},
onLoad(e) {
console.log(e)
this.shopId = JSON.parse(decodeURIComponent(e.storeInfo)).shopId;
this.storeInfo = JSON.parse(decodeURIComponent(e.storeInfo));
this.listinfo.name = JSON.parse(decodeURIComponent(e.storeInfo)).shopName;
this.tableCode = e.tableCode;
console.log(this.storeInfo)
this.shopId =this.storeInfo.shopId;
this.listinfo.name = this.storeInfo.shopName;
if ( e.tableCode ) { this.tableCode = e.tableCode; }
if ( e.dinersNum ) { this.dinersNum = e.dinersNum; }
this.listinfo.details = JSON.parse(e.cartLists).data;
this.listinfo.payAmount = JSON.parse(e.cartLists).amount;
if ( this.storeInfo.eatModel.indexOf("dine-in") != -1 ) {
this.eatModel = ["dine-in"]
} else {
this.eatModel = ["take-out"]
}
if ( e.tableCode ) {
this.getProductqueryShop()
}
@@ -333,8 +348,13 @@
} else {
switch (msg.type) {
case 'createOrder':
if ( this.storeInfo.registerType == 'restaurant') {
uni.switchTab({
url: '/pages/order/order'
});
return;
}
this.isSocket = true;
console.log(msg)
this.listinfoid = msg.data.id
this.listinfo.details = msg.data.detailList;
this.listinfo.payAmount = msg.data.amount;
@@ -378,8 +398,9 @@
* 监听送餐/打包切换
* @param {Object} val
*/
tabClick ( val ) {
this.is_type = val;
tabClick ( index,val ) {
this.is_type = index;
this.eatModel.push(val);
},
/**
@@ -487,6 +508,8 @@
"isYhq": 0, // 是否使用优惠券( 1 使用, 0 不使用),
"isBuyYhq": 0, // 是否购买优惠券( 1 购买, 0 不够买)
"productId": '', //商品id
"dinersNum": this.dinersNum, //就餐人数
"eatModel": this.eatModel, //就餐模式
"shopId": uni.cache.get('shopId'),
"userId": uni.cache.get('userInfo').id,
}
@@ -692,6 +715,9 @@
</script>
<style lang="scss">
.container{
padding-bottom: 246rpx;
}
.head{
width: 100%;
padding: $uni-spacing-row-base;
@@ -930,10 +956,12 @@
.tableName{
display: flex;
.name{
border-right: 2rpx solid #d6d6d6;
padding-right: 16rpx;
margin-right: 16rpx;
}
.num{
border-left: 2rpx solid #d6d6d6;
padding-left: 16rpx;
}
}
@@ -1082,7 +1110,7 @@
padding: 0 30rpx;
box-sizing: border-box;
margin-top: 30rpx;
padding-bottom: 246rpx;
.paymentMethod_content{
background-color: $uni-bg-color;
border-radius: 22rpx;

View File

@@ -7,11 +7,12 @@
<view class="title_text">请选择就餐人数</view>
<view class="title_tabNum">桌号A2</view>
</view>
<view class="num">
<view class="num" :class="{'active':numIndex==-1}">
<view class="num_item" :class="{'active':numIndex==index }" @click="tabCut(index)" v-for="(item,index) in 9" :key="index">{{item+1}}</view>
<view class="num_item" :class="{'active':numIndex==-1 }" @click="tabCut(-1)">其他</view>
<!-- <view class="num_item" v-else :class="{'active':numIndex==-1 }"></view> -->
<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>
</view>
<view class="startBtn">
<view class="startBtn" @click="start">
开始点餐
</view>
</view>
@@ -32,12 +33,12 @@
tableCode: null,
shopId: null,
numIndex: 0,
num: 1,
otherNum: '其他',
dinersNum: 1,
};
},
onLoad(options) {
this.tableCode = uni.cache.get('tableCode');
},
onShow() {
},
@@ -48,11 +49,38 @@
* 切换桌型
*/
tabCut(index) {
console.log(index)
this.numIndex = index;
if ( index != -1) {
this.num = index+1;
this.dinersNum = index+1;
} else {
this.otherNum = this.otherNum == "其他" ? "" : this.otherNum;
}
},
blur ( index ) {
this.otherNum = this.otherNum == "" ? "其他" : this.otherNum;
},
/**
* 开始点餐
*/
start () {
if ( this.numIndex == -1 && (this.otherNum == "其他"||this.otherNum <= 0)) {
uni.showToast({
title: '请选择就餐人数',
icon: 'none',
})
return;
}
if ( this.numIndex == -1 && this.otherNum != "其他") {
this.dinersNum = this.otherNum
}
uni.pro.navigateTo('order_food/order_food', {
tableCode: this.tableCode,
dinersNum: this.dinersNum,
})
}
}
};
@@ -110,7 +138,7 @@
text-align: center;
margin-right: 28rpx;
margin-bottom: 32rpx;
background: #FEF4EB;
background-color: #FEF4EB;
border-radius: 12rpx;
font-weight: 400;
font-size: 28rpx;
@@ -119,10 +147,39 @@
.num_item:nth-child(5n){
margin-right: 0;
}
::v-deep .u-input{
width: 104rpx;
height: 56rpx;
line-height: 56rpx;
text-align: center;
margin-bottom: 32rpx;
background-color: #FEF4EB;
border-radius: 12rpx;
}
::v-deep input{
font-weight: 400;
font-size: 28rpx!important;
color: #333333!important;
text-align: center!important;
}
.active{
color: #fff;
background-color: #E8AD7B;
}
}
::v-deep .num.active .u-input{
width: 104rpx;
height: 56rpx;
line-height: 56rpx;
text-align: center;
margin-bottom: 32rpx;
background-color: #E8AD7B!important;
border-radius: 12rpx;
}
::v-deep .num.active input{
color: #fff!important;
}
}

View File

@@ -0,0 +1,559 @@
<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

@@ -102,19 +102,36 @@
<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="orderInfo">
<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 class="row">
<text class="t">下单门店</text>
<text class="info">{{listinfo.name}}</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 class="row">
<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 class="fixedview">
<view class="flex-between" v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'">
<view class="fixedview_one flex-start">
@@ -139,6 +156,7 @@
pay_type: 1,
orderId: '',
listinfo: {},
status: [],
srcimge: 'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/wx.jpg'
};
},
@@ -164,6 +182,9 @@
})
if (res.code == 0) {
this.listinfo = res.data;
if (this.listinfo.useType == "dine-in-before") {
//堂食先付费
}
}
},
@@ -248,7 +269,7 @@
</script>
<style scoped lang="scss">
page{
::v-deep page{
background-color: #F7F7F7;
}
@@ -378,7 +399,6 @@
}
.shop-info {
margin-top: 32rpx;
.item:nth-child(1) {
margin-top: 0;
}
@@ -435,7 +455,6 @@
}
}
}
.total-wrap {
width: 100%;
display: flex;
@@ -509,6 +528,33 @@
}
}
.orderInfo{
background: #FFFFFF;
border-radius: 18rpx 18rpx 18rpx 18rpx;
margin-top: 32rpx;
padding: 32rpx 34rpx;
.row {
display: flex;
justify-content: space-between;
margin-bottom: 32rpx;
.t {
font-weight: bold;
font-size: 28rpx;
color: #333333;
}
.info {
font-weight: 400;
font-size: 24rpx;
color: #666666;
}
}
.row:last-child{
margin-bottom: none;
}
}