优惠券相关修改更新
This commit is contained in:
@@ -85,6 +85,9 @@ export default {
|
||||
creatOrder(data) { //创建订单
|
||||
return uni.api.post("/order/creatOrder", data);
|
||||
},
|
||||
useCoupon(data) { //订单选择优惠券
|
||||
return uni.api.post("/order/useCoupon", data);
|
||||
},
|
||||
|
||||
|
||||
// 团购订单列表
|
||||
|
||||
@@ -8,6 +8,8 @@ const proxyApi = "/api"
|
||||
// const proxyApiwws = 'ws://192.168.1.15:9888/netty' // 测试
|
||||
const proxyApi = 'https://wxcashiertest.sxczgkj.cn/cashierService' // 测试
|
||||
const proxyApiwws = 'wss://wxcashiertest.sxczgkj.cn/netty' // 测试
|
||||
// const proxyApi = 'https://pre-cashier.sxczgkj.cn/cashierService' // 预发布
|
||||
// const proxyApiwws = 'wss://pre-cashier.sxczgkj.cn/netty' // 预发布
|
||||
// const proxyApi = 'https://cashier.sxczgkj.cn/cashierService' // 线上
|
||||
// const proxyApiwws = 'wss://cashier.sxczgkj.cn/netty' // 线上
|
||||
// #endif
|
||||
|
||||
@@ -8,13 +8,16 @@
|
||||
<view class="reg-head">
|
||||
<view class="reg-head-img">
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<button class="reg-head-img" type="default" open-type="chooseAvatar" @chooseavatar="uploadImg">
|
||||
<!-- #endif -->
|
||||
<!-- #ifdef MP-ALIPAY -->
|
||||
<button class="reg-head-img" type="default" open-type="chooseAvatar" @chooseAvatar="uploadImg">
|
||||
<!-- #endif -->
|
||||
<button class="reg-head-img" type="default" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
|
||||
<image class="reg-head-img" :src="userHeadImg || 'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/menber/head_default.png'" mode="aspectFill"></image>
|
||||
</button>
|
||||
<!-- #endif -->
|
||||
<!-- #ifdef MP-ALIPAY -->
|
||||
<button class="reg-head-img" @click="onChooseAvatar">
|
||||
<image class="reg-head-img" :src="userHeadImg || 'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/menber/head_default.png'" mode="aspectFill"></image>
|
||||
</button>
|
||||
<!-- #endif -->
|
||||
|
||||
</view>
|
||||
</view>
|
||||
<view class="reg-cell">
|
||||
@@ -41,7 +44,7 @@
|
||||
</view>
|
||||
<view class="reg-cell">
|
||||
<view class="lable">手机号</view>
|
||||
<u-input class="value" v-model="telephone" fontSize="14px" type="text" input-align="left" readonly placeholder="获取微信手机号" :custom-style="{border:'none'}" placeholder-style="color:#999;font-size: 28rpx"/>
|
||||
<u-input class="value" v-model="telephone" fontSize="14px" type="text" input-align="left" readonly placeholder="获取手机号" :custom-style="{border:'none'}" placeholder-style="color:#999;font-size: 28rpx"/>
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<button class="getPhone" open-type="getPhoneNumber" @getphonenumber="getPhone">
|
||||
<!-- #endif -->
|
||||
@@ -49,7 +52,7 @@
|
||||
<button class="getPhone" open-type="getAuthorize" scope='phoneNumber' @getAuthorize="getPhone" @error="getPhoneError">
|
||||
<!-- #endif -->
|
||||
|
||||
<view class="text">{{'获取微信手机号'}}</view>
|
||||
<view class="text">{{'获取手机号'}}</view>
|
||||
</button>
|
||||
</view>
|
||||
<view class="agreement">
|
||||
@@ -154,11 +157,10 @@
|
||||
* 上传头像
|
||||
* @param {Object} e
|
||||
*/
|
||||
uploadImg(e) {
|
||||
const {
|
||||
avatarUrl
|
||||
} = e.detail
|
||||
// this.userHeadImg = avatarUrl
|
||||
onChooseAvatar(e) {
|
||||
let _this = this;
|
||||
//#ifdef MP-WEIXIN
|
||||
let avatarUrl = e.detail.avatarUrl
|
||||
uni.uploadFile({
|
||||
url: uni.conf.baseUrl + '/common/upload',
|
||||
// url: uni.conf.baseUrl + '/common/upload',
|
||||
@@ -167,7 +169,9 @@
|
||||
environment: 'app',
|
||||
type: 'android',
|
||||
version: '1.7.3',
|
||||
'content-type': 'multipart/form-data'
|
||||
},
|
||||
fileType:'image',
|
||||
name: "file",
|
||||
formData: {
|
||||
file: avatarUrl,
|
||||
@@ -180,6 +184,49 @@
|
||||
console.log(res)
|
||||
}
|
||||
});
|
||||
// #endif
|
||||
//#ifdef MP-ALIPAY
|
||||
uni.chooseImage({
|
||||
count: 1, // 默认9,设置图片的数量
|
||||
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
|
||||
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
|
||||
success: function (res) {
|
||||
// 成功选择图片后
|
||||
let avatarUrl = res.tempFilePaths[0]; // 获取文件路径
|
||||
|
||||
my.uploadFile({
|
||||
url: uni.conf.baseUrl + '/common/upload',
|
||||
// url: uni.conf.baseUrl + '/common/upload',
|
||||
filePath: avatarUrl,
|
||||
header: {
|
||||
environment: 'app',
|
||||
type: 'android',
|
||||
version: '1.7.3',
|
||||
'content-type': 'multipart/form-data'
|
||||
},
|
||||
fileType:'image',
|
||||
name: "file",
|
||||
formData: {
|
||||
file: avatarUrl,
|
||||
},
|
||||
success: (uploadFileRes) => {
|
||||
let { data } = JSON.parse(uploadFileRes.data)
|
||||
_this.userHeadImg = data
|
||||
},
|
||||
fail: (res) => {
|
||||
console.log(res)
|
||||
}
|
||||
});
|
||||
},
|
||||
fail: (res) => {
|
||||
console.log(res)
|
||||
}
|
||||
});
|
||||
|
||||
// #endif
|
||||
|
||||
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -372,8 +372,8 @@
|
||||
title: '加载中',
|
||||
mask: true
|
||||
})
|
||||
// #ifdef MP-WEIXIN
|
||||
uni.requestPayment({
|
||||
// #ifdef MP-WEIXIN
|
||||
provider: 'wxpay', //支付类型-固定值
|
||||
partnerid: res.data.appId, // 微信支付商户号
|
||||
timeStamp: res.data.timeStamp, // 时间戳(单位:秒)
|
||||
@@ -381,12 +381,18 @@
|
||||
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) => {
|
||||
uni.showToast({
|
||||
title: "支付成功"
|
||||
})
|
||||
uni.hideLoading()
|
||||
let pages = getCurrentPages()
|
||||
// #ifdef MP-WEIXIN
|
||||
uni.requestSubscribeMessage({
|
||||
tmplIds:["AV-KybUHaK3KtFVLqpy6PHccHBS7XeX__mOM4RbufnQ"],
|
||||
complete() {
|
||||
@@ -406,6 +412,22 @@
|
||||
|
||||
},
|
||||
})
|
||||
// #endif
|
||||
// #ifdef MP-ALIPAY
|
||||
if ( _this.type && _this.type == "topUpActivity") {
|
||||
uni.pro.navigateBack()
|
||||
} else {
|
||||
if ( pages.length > 1) {
|
||||
_this.shopInfo()
|
||||
} else {
|
||||
setTimeout(res => {
|
||||
uni.switchTab({
|
||||
url: '/pages/index/index'
|
||||
})
|
||||
}, 500)
|
||||
}
|
||||
}
|
||||
// #endif
|
||||
|
||||
|
||||
|
||||
@@ -415,7 +437,6 @@
|
||||
}
|
||||
});
|
||||
uni.hideLoading()
|
||||
// #endif
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -28,10 +28,10 @@
|
||||
<text>{{shopUserInfo.amount || '0.00'}}</text><text>储值</text>
|
||||
</view>
|
||||
<view class="card_bom_item">
|
||||
<text>0</text><text>积分</text>
|
||||
<text>{{shopUserInfo.accountPoints || '0'}}</text><text>积分</text>
|
||||
</view>
|
||||
<view class="card_bom_item" @click="itemClick(3)">
|
||||
<text>0</text><text>优惠券</text>
|
||||
<text>{{shopUserInfo.couponNum || '0'}}</text><text>优惠券</text>
|
||||
</view>
|
||||
<view class="card_bom_item">
|
||||
<text>0</text><text>权益卡</text>
|
||||
@@ -49,7 +49,7 @@
|
||||
<view class="card_bottom_title">感谢你 2 天陪伴</view>
|
||||
<view class="flex-start">
|
||||
<view class="card_bottom_text">您今天的幸运词:<text class="luckyWord">林波微步</text></view>
|
||||
<image class="card_bottom_icon" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/menber/member_icon2.png" mode="aspectFill"></image>
|
||||
<!-- <image class="card_bottom_icon" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/menber/member_icon2.png" mode="aspectFill"></image> -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<text class="top_box_one_text">当前账号</text>
|
||||
<input type="number" v-model="mobile" placeholder="请输入手机号" maxlength="11" disabled="disabled" />
|
||||
<button v-if="!mobile" class="getPhone" open-type="getPhoneNumber" @getphonenumber="getPhone">
|
||||
<view class="text">获取微信手机号</view>
|
||||
<view class="text">获取手机号</view>
|
||||
</button>
|
||||
|
||||
</view>
|
||||
|
||||
@@ -96,22 +96,16 @@
|
||||
tableCode:{
|
||||
immediate: true,
|
||||
handler (newVal) {
|
||||
console.log(newVal)
|
||||
console.log("tableCode1==",this.tableCode)
|
||||
}
|
||||
},
|
||||
shopId:{
|
||||
immediate: true,
|
||||
handler (newVal) {
|
||||
console.log(newVal)
|
||||
console.log("shopId1==",this.shopId)
|
||||
}
|
||||
},
|
||||
|
||||
},
|
||||
mounted() {
|
||||
console.log("tableCode3==",this.tableCode)
|
||||
console.log("shopId3==",this.shopId)
|
||||
},
|
||||
methods: {
|
||||
|
||||
@@ -128,8 +122,6 @@
|
||||
* @param {Object} a
|
||||
*/
|
||||
async cartListadd(item, index, c) {
|
||||
console.log(this.shopId)
|
||||
console.log(this.tableCode)
|
||||
try {
|
||||
if ( c == "+" && item.isVip == 1){
|
||||
return;
|
||||
|
||||
@@ -55,17 +55,11 @@
|
||||
|
||||
},
|
||||
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: {
|
||||
|
||||
@@ -991,7 +991,6 @@
|
||||
})
|
||||
this.salePrice = res.data.salePrice // 价格
|
||||
let data = null;
|
||||
console.log(a)
|
||||
if (a == 1) { //1添加购物车 2是websocket返回这个商品的价格(应为不同的多规格商品返回不同的价格)
|
||||
let params = {
|
||||
"skuId": res.data.id,
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
'containertopboxitemleft_tows': status != 1,
|
||||
'containertopboxitemleft_nameVip': item.type == 2,
|
||||
}">
|
||||
{{ item.type == 2 ? item.detail : '优惠券(元)'}}
|
||||
{{ item.type == 2 ? item.name : '优惠券(元)'}}
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -84,19 +84,27 @@
|
||||
{
|
||||
name: '已使用',
|
||||
type: '2'
|
||||
},
|
||||
{
|
||||
name: '已过期',
|
||||
type: '-1'
|
||||
}
|
||||
],
|
||||
tabIndex: 1,
|
||||
list: [],
|
||||
status: 1,
|
||||
type: "",
|
||||
payAmount: 0,
|
||||
shoppingCart: [],
|
||||
productList: [],
|
||||
|
||||
};
|
||||
},
|
||||
onLoad(options) {
|
||||
if (options.type) {
|
||||
this.type = options.type;
|
||||
}
|
||||
if (options.type) { this.type = options.type }
|
||||
if (options.payAmount) { this.payAmount = options.payAmount }
|
||||
if (options.shoppingCart) { this.shoppingCart = JSON.parse(decodeURIComponent(options.shoppingCart)) }
|
||||
if (options.productList) { this.productList = JSON.parse(decodeURIComponent(options.productList)) }
|
||||
this.getCouponList()
|
||||
},
|
||||
|
||||
@@ -117,13 +125,26 @@
|
||||
*/
|
||||
async getCouponList() {
|
||||
try {
|
||||
let res = await this.api.conponList({
|
||||
let params = {
|
||||
userId: uni.cache.get('userInfo').id,
|
||||
shopId: uni.cache.get('shopId'),
|
||||
status: this.status
|
||||
})
|
||||
}
|
||||
if ( this.type == 'confirm_order_coupon' || this.type == 'confirm_order_product' ) {
|
||||
params.orderId = -1;
|
||||
}
|
||||
let res = await this.api.conponList(params)
|
||||
if (res.code == 0) {
|
||||
this.list = res.data;
|
||||
console.log(res)
|
||||
let list = [];
|
||||
if ( this.type == 'confirm_order_coupon') {
|
||||
list = res.data.filter(v => v.type == 1);
|
||||
}else if ( this.type == 'confirm_order_product') {
|
||||
list = res.data.filter(v => v.type == 2);
|
||||
} else {
|
||||
list = res.data;
|
||||
}
|
||||
this.list = list;
|
||||
}
|
||||
} catch (e) {
|
||||
//TODO handle the exception
|
||||
@@ -135,9 +156,73 @@
|
||||
*/
|
||||
navigatorGo ( item ) {
|
||||
uni.cache.set('shopId',item.shopId)
|
||||
if ( this.type == 'confirm_order') {
|
||||
uni.$emit('couponItem', JSON.stringify(item))
|
||||
uni.navigateBack();
|
||||
if ( this.type == 'confirm_order_coupon' || this.type == 'confirm_order_product') {
|
||||
if ( item.type == 1 ) {
|
||||
if( this.payAmount < item.fullAmount) {
|
||||
uni.showToast({
|
||||
title: "当前订单金额不足使用金额",
|
||||
icon: "none",
|
||||
})
|
||||
return;
|
||||
}
|
||||
uni.$emit('couponItem', JSON.stringify(item))
|
||||
uni.navigateBack();
|
||||
} else {
|
||||
let productNum = 0;//商品购物车数量
|
||||
let productTicketNum = 0;//商品券使用数量
|
||||
let product = this.shoppingCart.filter(v => v.productId == item.proId);
|
||||
let productTicket = this.productList.filter(v => v.productId == item.proId);
|
||||
if ( product.length <= 0 ) {
|
||||
uni.showToast({
|
||||
title: "购物车没有"+item.name,
|
||||
icon: "none",
|
||||
})
|
||||
return;
|
||||
}
|
||||
if (this.productList.filter(v => v.userCouponId == item.id).length > 0) {
|
||||
uni.showToast({
|
||||
title: `当前优惠券已选择`,
|
||||
icon: "none",
|
||||
})
|
||||
return;
|
||||
}
|
||||
// 计算当前商品购物车数量
|
||||
product.forEach(item => {
|
||||
productNum += item.number;
|
||||
})
|
||||
// 计算当前商品券使用数量
|
||||
productTicket.forEach(item => {
|
||||
productTicketNum += item.num;
|
||||
})
|
||||
if ( (productNum - productTicketNum) == 0 ) {
|
||||
uni.showToast({
|
||||
title: `当前商品已经全部抵扣`,
|
||||
icon: "none",
|
||||
})
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// let productNum = 0;
|
||||
// product.map(item => {
|
||||
// productNum += item.number
|
||||
// })
|
||||
// if ( productNum < item.num) {
|
||||
// uni.showToast({
|
||||
// title: `购物车${item.name}数量不足`,
|
||||
// icon: "none",
|
||||
// })
|
||||
// return;
|
||||
// }
|
||||
// if (product[0].number item.num) {
|
||||
|
||||
// }
|
||||
uni.$emit('couponItem', JSON.stringify(item))
|
||||
uni.navigateBack();
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
uni.pro.navigateTo('/pages/order_food/order_food', {
|
||||
shopId: item.shopId
|
||||
@@ -163,7 +248,7 @@
|
||||
margin-top: 32rpx;
|
||||
|
||||
.towcontentlistxitembox {
|
||||
width: 50%;
|
||||
width: 33.33%;
|
||||
font-family: PingFang SC, PingFang SC;
|
||||
font-weight: 500;
|
||||
font-size: 28rpx;
|
||||
|
||||
@@ -8,12 +8,15 @@
|
||||
<view class="list_item_right flex-center">
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<button class="list_item_right_head" type="default" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
|
||||
<!-- #endif -->
|
||||
<!-- #ifdef MP-ALIPAY -->
|
||||
<button class="list_item_right_head" type="default" open-type="chooseAvatar" @chooseAvatar="onChooseAvatar">
|
||||
<!-- #endif -->
|
||||
<image class="list_item_right_head" :src="userHeadImg" mode="aspectFill"></image>
|
||||
</button>
|
||||
<!-- #endif -->
|
||||
<!-- #ifdef MP-ALIPAY -->
|
||||
<button class="list_item_right_head" @click="onChooseAvatar">
|
||||
<image class="list_item_right_head" :src="userHeadImg" mode="aspectFill"></image>
|
||||
</button>
|
||||
<!-- #endif -->
|
||||
|
||||
<u-icon name="arrow-right" color="#999999" size="16"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
@@ -257,8 +260,9 @@
|
||||
* @param {Object} e
|
||||
*/
|
||||
onChooseAvatar(e) {
|
||||
const { avatarUrl } = e.detail
|
||||
// this.userHeadImg = avatarUrl
|
||||
let _this = this;
|
||||
//#ifdef MP-WEIXIN
|
||||
let avatarUrl = e.detail.avatarUrl
|
||||
uni.uploadFile({
|
||||
url: uni.conf.baseUrl + '/common/upload',
|
||||
// url: uni.conf.baseUrl + '/common/upload',
|
||||
@@ -267,22 +271,63 @@
|
||||
environment: 'app',
|
||||
type: 'android',
|
||||
version: '1.7.3',
|
||||
'content-type': 'multipart/form-data'
|
||||
},
|
||||
fileType:'image',
|
||||
name: "file",
|
||||
formData: {
|
||||
file: avatarUrl,
|
||||
},
|
||||
success: (uploadFileRes) => {
|
||||
console.log(uploadFileRes)
|
||||
let {
|
||||
data
|
||||
} = JSON.parse(uploadFileRes.data)
|
||||
let { data } = JSON.parse(uploadFileRes.data)
|
||||
this.userHeadImg = data
|
||||
},
|
||||
fail: (res) => {
|
||||
console.log(res)
|
||||
}
|
||||
});
|
||||
// #endif
|
||||
//#ifdef MP-ALIPAY
|
||||
uni.chooseImage({
|
||||
count: 1, // 默认9,设置图片的数量
|
||||
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
|
||||
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
|
||||
success: function (res) {
|
||||
// 成功选择图片后
|
||||
let avatarUrl = res.tempFilePaths[0]; // 获取文件路径
|
||||
|
||||
my.uploadFile({
|
||||
url: uni.conf.baseUrl + '/common/upload',
|
||||
// url: uni.conf.baseUrl + '/common/upload',
|
||||
filePath: avatarUrl,
|
||||
header: {
|
||||
environment: 'app',
|
||||
type: 'android',
|
||||
version: '1.7.3',
|
||||
'content-type': 'multipart/form-data'
|
||||
},
|
||||
fileType:'image',
|
||||
name: "file",
|
||||
formData: {
|
||||
file: avatarUrl,
|
||||
},
|
||||
success: (uploadFileRes) => {
|
||||
let { data } = JSON.parse(uploadFileRes.data)
|
||||
_this.userHeadImg = data
|
||||
},
|
||||
fail: (res) => {
|
||||
console.log(res)
|
||||
}
|
||||
});
|
||||
},
|
||||
fail: (res) => {
|
||||
console.log(res)
|
||||
}
|
||||
});
|
||||
|
||||
// #endif
|
||||
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<view class="time">{{item.useDetail}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="label t">每邀请{{InviteFriendsData.invitedNum}}个用户可获得</view>
|
||||
<view class="label t">每邀请{{InviteFriendsData.invitedNum||''}}个用户可获得</view>
|
||||
<view class="card" v-for="(item,index) in InviteFriendsData.rewardCoupons">
|
||||
<view class="left">
|
||||
<view class="num"><text>¥</text>{{item.discountAmount}}</view>
|
||||
@@ -38,7 +38,7 @@
|
||||
>{{item.label}}{{item.num||0}}人</view>
|
||||
</view>
|
||||
<view class="tabContent">
|
||||
<viwe class="tabContent_item" v-for="(item,index) in shareRecordData.list" :key="index">
|
||||
<view class="tabContent_item" v-for="(item,index) in shareRecordData.list" :key="index">
|
||||
<view class="top">
|
||||
<view class="name">{{item.invitedName}}</view>
|
||||
<view class="status" :style="{color: isSuccess ? '#333' : '#FF534B'}">{{
|
||||
@@ -46,7 +46,7 @@
|
||||
}}</view>
|
||||
</view>
|
||||
<view class="time">{{item.createTime}}</view>
|
||||
</viwe>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -68,7 +68,8 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="btn" v-if="shareOpenData.status == 1" @click="shareReceive">领券</view>
|
||||
<view class="btn" v-else style="background-color: #999;">领券</view>
|
||||
<view class="btn" v-else-if="shareOpenData.status == 0" style="background-color: #999;">已领完</view>
|
||||
<view class="btn" v-else style="background-color: #999;">非新用户不可领取</view>
|
||||
|
||||
|
||||
</view>
|
||||
@@ -142,6 +143,14 @@
|
||||
this.share.path = `/pagesInviteFriends/index/index?shopId=${this.shopId}&is_type=he&shareId=${this.InviteFriendsData.id}&invitedId=${uni.cache.get('userInfo').id}`
|
||||
this.share.imageUrl = res.data.shareImg
|
||||
this.shareRecord();
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: "none",
|
||||
})
|
||||
setTimeout(()=>{
|
||||
uni.navigateBack();
|
||||
},2000)
|
||||
}
|
||||
},
|
||||
|
||||
@@ -190,6 +199,7 @@
|
||||
shopId : this.shopId,
|
||||
}
|
||||
let res = await this.api.shareReceive(params)
|
||||
console.log(res)
|
||||
if ( res.code == 0 ) {
|
||||
uni.showToast({
|
||||
title: "领取成功",
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="status" v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'">未付款</view>
|
||||
<view class="totalAmount">
|
||||
<view class="label">小计¥</view>
|
||||
@@ -52,6 +53,40 @@
|
||||
<view>{{listinfo.orderInfo.seatAmount}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-for="(item,indexe) in favorable" :key="indexe">
|
||||
<view class="favorable" :class="{column:item.value.length>0&&item.type=='product'}" @click="goUrl(item)">
|
||||
<view class="favorable_left">
|
||||
<!-- <image class="icon" :src="item.url" mode="aspectFill"/> -->
|
||||
<text class="name"> {{ item.name }} </text>
|
||||
</view>
|
||||
<view class="favorable_right" v-if="item.type=='coupon'">
|
||||
<text class="favorable_right_text">{{item.value}}</text>
|
||||
<u-icon name="arrow-right" color="#575B66" size="28"></u-icon>
|
||||
</view>
|
||||
<view class="favorable_right" :class="{column:item.value.length>0}" v-if="item.type=='product'">
|
||||
<view class="favorable_right_text" v-for="(items,indexs) in item.value" :key="indexs">
|
||||
<text>{{items.name}}</text>
|
||||
<text>X{{items.num}}</text>
|
||||
<text>-¥{{items.discountAmount || 0}}</text>
|
||||
</view>
|
||||
<u-icon v-if="item.value.length <= 0" name="arrow-right" color="#575B66" size="28"></u-icon>
|
||||
</view>
|
||||
<view class="favorable_right" v-if="item.type=='points'" @click.stop="pointsChange">
|
||||
<text class="favorable_right_text" style="color: #666;margin-right: 16rpx;" v-if="calcUsablePointsData.usable">
|
||||
使用 {{ calcUsablePointsData.pointsNum}} 积分抵扣¥{{calcUsablePointsData.pointsNum/calcUsablePointsData.equivalentPoints}}
|
||||
</text>
|
||||
<text class="favorable_right_text" style="color: #666;margin-right: 16rpx;color: #DE4D3A;" v-else>
|
||||
{{calcUsablePointsData.unusableReason}}
|
||||
</text>
|
||||
|
||||
<u-checkbox-group iconPlacement="right" @change="pointsChange">
|
||||
<u-checkbox v-model="isPointsChecked" :disabled="freeCheck||!calcUsablePointsData.usable" :checked="isPointsChecked" activeColor="#E8AD7B" shape="circle" icon-size="36" size="36">
|
||||
</u-checkbox>
|
||||
</u-checkbox-group>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view class="total-wrap">
|
||||
<view>总计¥</view>
|
||||
<view class="price"> {{listinfo.payAmount}} </view>
|
||||
@@ -81,11 +116,11 @@
|
||||
</view>
|
||||
<view class="row">
|
||||
<text class="t">备注:</text>
|
||||
<text class="info">{{ listinfo.orderInfo.remark||""}}</text>
|
||||
<text class="info">{{ listinfo.orderInfo.remark || ""}}</text>
|
||||
</view>
|
||||
<view class="row">
|
||||
<text class="t">就餐人数:</text>
|
||||
<text class="info">{{ listinfo.orderInfo.seatCount}}</text>
|
||||
<text class="info">{{ listinfo.orderInfo.seatCount || ""}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -97,19 +132,184 @@
|
||||
|
||||
data() {
|
||||
return {
|
||||
|
||||
|
||||
favorable: [
|
||||
{ name: "优惠券", type: "coupon",value: "", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/coupon.png"},
|
||||
{ name: "商品券", type: "product",value: [], url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/coupon.png"},
|
||||
// { name: "团购优惠", type: "group",value: "", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/groupOffer.png"},
|
||||
{ name: "积分抵扣", type: "points",value: "", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/points.png" }
|
||||
],
|
||||
calcUsablePointsData: null,
|
||||
isPointsChecked: false,
|
||||
freeCheck: false,
|
||||
freeDisabled: false,
|
||||
userCouponInfos: [],
|
||||
}
|
||||
},
|
||||
props:{
|
||||
listinfo:{
|
||||
type: Object
|
||||
}
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
console.log(this.listinfo.shopId)
|
||||
this.getCalcUsablePoints()
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 监听优惠券/商品券选择
|
||||
* @param {Object} data
|
||||
*/
|
||||
changeCoupon ( data ) {
|
||||
let _this = this;
|
||||
// uni.$off('couponItem')
|
||||
let couponData = JSON.parse(data)
|
||||
console.log('监听到事件来自返回的参数:' , couponData);
|
||||
if ( couponData.type == 1 ) { //满减优惠券
|
||||
let couponList = _this.userCouponInfos.filter(v => v.type == 1);
|
||||
//不包含优惠券的金额
|
||||
let currentPayAmount = (couponList.length > 0 ? _this.listinfo.payAmount + couponList[0].discountAmount : _this.listinfo.payAmount)
|
||||
// 判断优惠金额不能大于支付金额
|
||||
if ( couponData.discountAmount < currentPayAmount) {
|
||||
_this.listinfo.payAmount = ( currentPayAmount - couponData.discountAmount).toFixed(2)
|
||||
_this.favorable[0].value = ('-¥'+couponData.discountAmount)
|
||||
if ( couponList.length > 0) {
|
||||
_this.userCouponInfos.map(item => {
|
||||
if ( item.type == 1 ) {
|
||||
item.userCouponId = couponData.id
|
||||
item.type = couponData.type
|
||||
item.discountAmount = couponData.discountAmount
|
||||
item.num = couponData.type == 1 ? 1 : couponData.num
|
||||
}
|
||||
})
|
||||
} else {
|
||||
_this.favorable[0].value = ('-¥'+couponData.discountAmount)
|
||||
_this.userCouponInfos.push({
|
||||
userCouponId: couponData.id,
|
||||
type: couponData.type,
|
||||
discountAmount: couponData.discountAmount,
|
||||
num: couponData.type == 1 ? 1 : couponData.num,
|
||||
})
|
||||
}
|
||||
if ( _this.isPointsChecked) {
|
||||
_this.pointsChange()
|
||||
_this.getCalcUsablePoints()
|
||||
}
|
||||
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: "优惠券满减金额大于订单金额不可使用",
|
||||
icon: "none",
|
||||
})
|
||||
}
|
||||
} else { //商品券
|
||||
// this.listinfo.details
|
||||
// 筛选选中商品券商品列表
|
||||
let couponList = _this.listinfo.details.filter(v => v.productId == couponData.proId);
|
||||
//金额从小到大排序
|
||||
let minCouponList = couponList.sort((a, b) => (a.memberPrice > 0 ? a.memberPrice : a.salePrice) - (b.memberPrice > 0 ? b.memberPrice : b.salePrice))
|
||||
let productTicketList = _this.userCouponInfos.filter(v => v.productId == couponData.proId);
|
||||
//商品券抵扣的数量
|
||||
let productNum = couponData.num;
|
||||
let productPayAmount = 0;
|
||||
let productTicketNum = 0;
|
||||
let productNumber = 0;
|
||||
productTicketList.map((item,index) => {
|
||||
productTicketNum += item.num
|
||||
})
|
||||
console.log(productTicketNum)
|
||||
minCouponList.map((item,index) => {
|
||||
productNumber += item.number
|
||||
if ( productNum > 0 && productNumber > productTicketNum) {
|
||||
let num = productNum >= item.number ? item.number : productNum
|
||||
productNum = (productNum - item.number) >= 0 ? (productNum - item.number) : 0;
|
||||
console.log(num)
|
||||
console.log(item.salePrice)
|
||||
productPayAmount = productPayAmount + (num*(item.memberPrice > 0 ? item.memberPrice : item.salePrice))
|
||||
}
|
||||
})
|
||||
console.log(minCouponList)
|
||||
_this.userCouponInfos.push({
|
||||
userCouponId: couponData.id,
|
||||
type: couponData.type,
|
||||
productId: couponData.proId,
|
||||
discountAmount: productPayAmount,
|
||||
num: productNum == 0 ? couponData.num : (couponData.num - productNum),
|
||||
})
|
||||
_this.favorable[1].value.push({
|
||||
userCouponId: couponData.id,
|
||||
name: couponData.name,
|
||||
type: couponData.type,
|
||||
productId: couponData.proId,
|
||||
discountAmount: productPayAmount,
|
||||
num: productNum == 0 ? couponData.num : (couponData.num - productNum),
|
||||
})
|
||||
|
||||
if ( _this.isPointsChecked) {
|
||||
_this.pointsChange()
|
||||
_this.getCalcUsablePoints()
|
||||
}
|
||||
}
|
||||
uni.$off('couponItem')
|
||||
},
|
||||
/**
|
||||
* 积分状态监听
|
||||
*/
|
||||
pointsChange (){
|
||||
if ( this.freeCheck || !this.calcUsablePointsData.usable) {
|
||||
return;
|
||||
}
|
||||
this.isPointsChecked = !this.isPointsChecked
|
||||
if ( this.isPointsChecked ) {
|
||||
this.freeDisabled = true
|
||||
|
||||
this.listinfo.payAmount = (this.listinfo.payAmount-(this.calcUsablePointsData.pointsNum/this.calcUsablePointsData.equivalentPoints)).toFixed(2);
|
||||
} else {
|
||||
this.freeDisabled = false
|
||||
this.listinfo.payAmount = (Number(this.listinfo.payAmount)+(this.calcUsablePointsData.pointsNum/this.calcUsablePointsData.equivalentPoints)).toFixed(2);
|
||||
}
|
||||
},
|
||||
goUrl(item){
|
||||
switch (item.type){
|
||||
case 'coupon':
|
||||
let payAmount = this.listinfo.payAmount;
|
||||
let couponList = this.userCouponInfos.filter(v => v.type == 1);
|
||||
if ( couponList.length > 0 ) {
|
||||
payAmount = payAmount + couponList.discountAmount;
|
||||
}
|
||||
uni.pro.navigateTo('/pages/user/coupon', {
|
||||
type: "confirm_order_coupon",
|
||||
payAmount: payAmount,
|
||||
shoppingCart: JSON.stringify(this.listinfo.details)
|
||||
})
|
||||
break;
|
||||
case 'product':
|
||||
let productList = this.userCouponInfos.filter(v => v.type == 2);
|
||||
uni.pro.navigateTo('/pages/user/coupon', {
|
||||
type: "confirm_order_product",
|
||||
payAmount: this.listinfo.payAmount,
|
||||
shoppingCart: JSON.stringify(this.listinfo.details),
|
||||
productList: JSON.stringify(productList)
|
||||
})
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取积分相关信息
|
||||
*/
|
||||
async getCalcUsablePoints() {
|
||||
let params = {
|
||||
memberId: this.listinfo.orderInfo.memberId,
|
||||
orderAmount: this.listinfo.payAmount,
|
||||
}
|
||||
let res = await this.api.calcUsablePoints(params)
|
||||
this.calcUsablePointsData = res.data;
|
||||
if ( this.calcUsablePointsData.usable && this.listinfo.payAmount >= this.calcUsablePointsData.minPaymentAmount) {
|
||||
this.calcUsablePointsData.pointsNum = this.calcUsablePointsData.accountPoints >= this.calcUsablePointsData.maxUsablePoints ? this.calcUsablePointsData.maxUsablePoints : this.calcUsablePointsData.accountPoints
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 复制订单号
|
||||
* @param {Object} e
|
||||
@@ -339,6 +539,65 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.favorable{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
// padding: 0 30rpx;
|
||||
box-sizing: border-box;
|
||||
padding-bottom: 26rpx;
|
||||
padding-top: 26rpx;
|
||||
border-bottom: 2rpx solid #E5E5E5;
|
||||
.favorable_left{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.icon{
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
margin-right: 16rpx;
|
||||
}
|
||||
.name{
|
||||
font-size: 28rpx;
|
||||
font-weight: 400rpx;
|
||||
color: #333;
|
||||
}
|
||||
}
|
||||
.favorable_right{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.favorable_right_text{
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
font-weight: 400rpx;
|
||||
}
|
||||
|
||||
}
|
||||
.favorable_right.column{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
.favorable_right_text{
|
||||
margin-bottom: 10rpx;
|
||||
text:nth-child(1){
|
||||
font-size: 26rpx;
|
||||
color: #999;
|
||||
}
|
||||
text:nth-child(2){
|
||||
font-size: 26rpx;
|
||||
color: #999;
|
||||
margin: 0 30rpx;
|
||||
}
|
||||
text:nth-child(3){
|
||||
font-size: 26rpx;
|
||||
color: #333;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.favorable.column{
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.total-wrap {
|
||||
width: 100%;
|
||||
|
||||
@@ -91,7 +91,27 @@
|
||||
<view>{{listinfo.orderInfo.seatAmount}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="cell-item" v-if="listinfo.orderInfo.pointsDiscountAmount && listinfo.orderInfo.pointsDiscountAmount > 0">
|
||||
<block v-for="(item,index) in listinfo.orderInfo.couponInfoList.fullReductionCoupon" :key="index">
|
||||
<view class="cell-item" v-if="item.type == 1">
|
||||
<view class="label">优惠券</view>
|
||||
<view class="val">
|
||||
<view></view>
|
||||
<view style="font-size: 28rpx;">-¥</view>
|
||||
<view>{{item.discountAmount}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
<view class="cell-item column" v-if="listinfo.orderInfo.couponInfoList.productCoupon.length > 0">
|
||||
<view class="label">商品券</view>
|
||||
<view class="val column">
|
||||
<view class="productCoupon" v-for="(item,index) in listinfo.orderInfo.couponInfoList.productCoupon" :key="index">
|
||||
<view class="name">{{item.name}}</view>
|
||||
<view class="num">X{{item.finalUseNum}}</view>
|
||||
<view class="amount">-¥{{item.finalDiscountAmount}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="cell-item" v-if="listinfo.orderInfo && listinfo.orderInfo.pointsDiscountAmount && listinfo.orderInfo.pointsDiscountAmount > 0">
|
||||
<view class="label">积分抵扣</view>
|
||||
<view class="val">
|
||||
<view></view>
|
||||
@@ -137,7 +157,7 @@
|
||||
</view>
|
||||
<view class="row">
|
||||
<text class="t">就餐人数:</text>
|
||||
<text class="info">{{ listinfo.orderInfo.seatCount}}</text>
|
||||
<text class="info">{{ listinfo.orderInfo.seatCount || ""}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -380,13 +400,13 @@
|
||||
align-items: flex-end;
|
||||
padding-bottom: 32rpx;
|
||||
border-bottom: 2rpx dashed #e5e5e5;
|
||||
view:nth-child(1){
|
||||
>view:nth-child(1){
|
||||
font-weight: 400;
|
||||
font-size: 24rpx;
|
||||
color: #999999;
|
||||
margin-right: 42rpx;
|
||||
}
|
||||
view:nth-child(2){
|
||||
>view:nth-child(2){
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
font-weight: bold;
|
||||
@@ -394,6 +414,36 @@
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
.val.column{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
.productCoupon{
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
margin: 0 0 10rpx 0;
|
||||
.name{
|
||||
font-weight: 400;
|
||||
font-size: 26rpx;
|
||||
color: #999;
|
||||
margin: 0;
|
||||
}
|
||||
.num{
|
||||
font-weight: 400;
|
||||
font-size: 26rpx;
|
||||
color: #999;
|
||||
margin: 0 30rpx;
|
||||
line-height: 20rpx;
|
||||
}
|
||||
.amount{
|
||||
font-weight: bold;
|
||||
font-size: 26rpx;
|
||||
color: #333;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.cell-item.column{
|
||||
align-items: flex-start;
|
||||
}
|
||||
.total-wrap {
|
||||
width: 100%;
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
<view>{{packFee.toFixed(2)}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="cell-item" v-if="shopTableInfo&&shopTableInfo.seatNum&&sendType=='table'">
|
||||
<view class="cell-item" v-if="shopTableInfo&&shopTableInfo.seatNum&&sendType=='table'&&storeInfo.registerType == 'munchies'">
|
||||
<view class="label">餐位费</view>
|
||||
<view class="val">
|
||||
<view>X{{shopTableInfo.seatNum}}</view>
|
||||
@@ -88,20 +88,25 @@
|
||||
<view>{{(shopTableInfo.seatNum*storeInfo.tableFee).toFixed(2)}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-for="(item,index) in favorable" :key="index" >
|
||||
<view class="favorable" v-if="item.type!='points'" @click="goUrl(item)">
|
||||
<view v-for="(item,index) in favorable" :key="index" v-if="storeInfo.registerType == 'munchies'">
|
||||
<view class="favorable" :class="{column:item.value.length>0&&item.type=='product'}" @click="goUrl(item)">
|
||||
<view class="favorable_left">
|
||||
<image class="icon" :src="item.url" mode="aspectFill"/>
|
||||
<!-- <image class="icon" :src="item.url" mode="aspectFill"/> -->
|
||||
<text class="name"> {{ item.name }} </text>
|
||||
</view>
|
||||
<view class="favorable_right" ><text class="favorable_right_text">{{item.value}}</text> <u-icon name="arrow-right" color="#575B66" size="28"></u-icon></view>
|
||||
</view>
|
||||
<view class="favorable" v-else-if="item.type=='points'">
|
||||
<view class="favorable_left">
|
||||
<image class="icon" :src="item.url" mode="aspectFill"/>
|
||||
<text class="name"> {{ item.name }} </text>
|
||||
<view class="favorable_right" v-if="item.type=='coupon'">
|
||||
<text class="favorable_right_text">{{item.value}}</text>
|
||||
<u-icon name="arrow-right" color="#575B66" size="28"></u-icon>
|
||||
</view>
|
||||
<view class="favorable_right" @click.stop="pointsChange">
|
||||
<view class="favorable_right" :class="{column:item.value.length>0}" v-if="item.type=='product'">
|
||||
<view class="favorable_right_text" v-for="(items,indexs) in item.value" :key="indexs">
|
||||
<text>{{items.name}}</text>
|
||||
<text>X{{items.num}}</text>
|
||||
<text>-¥{{items.discountAmount || 0}}</text>
|
||||
</view>
|
||||
<u-icon v-if="item.value.length <= 0" name="arrow-right" color="#575B66" size="28"></u-icon>
|
||||
</view>
|
||||
<view class="favorable_right" v-if="item.type=='points'" @click.stop="pointsChange">
|
||||
<text class="favorable_right_text" style="color: #666;margin-right: 16rpx;" v-if="calcUsablePointsData.usable">
|
||||
使用 {{ calcUsablePointsData.pointsNum}} 积分抵扣¥{{calcUsablePointsData.pointsNum/calcUsablePointsData.equivalentPoints}}
|
||||
</text>
|
||||
@@ -115,6 +120,7 @@
|
||||
</u-checkbox-group>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
<view class="totalPrice">
|
||||
@@ -207,6 +213,7 @@
|
||||
eatModel: [],
|
||||
favorable: [
|
||||
{ name: "优惠券", type: "coupon",value: "", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/coupon.png"},
|
||||
{ name: "商品券", type: "product",value: [], url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/coupon.png"},
|
||||
// { name: "团购优惠", type: "group",value: "", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/groupOffer.png"},
|
||||
{ name: "积分抵扣", type: "points",value: "", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/points.png" }
|
||||
],
|
||||
@@ -216,7 +223,7 @@
|
||||
order: {
|
||||
phone: "",
|
||||
},
|
||||
userCouponInfos: null,
|
||||
userCouponInfos: [],
|
||||
shopTableInfo: null,
|
||||
freeDingConfig: null,
|
||||
cartLists: [],
|
||||
@@ -294,33 +301,107 @@
|
||||
if ( this.storeInfo.eatModel.indexOf(item.val) != -1) {
|
||||
item.show = true;
|
||||
}
|
||||
})
|
||||
uni.$on('couponItem',function(data){
|
||||
})
|
||||
uni.$on('couponItem',this.changeCoupon)
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 监听优惠券/商品券选择
|
||||
* @param {Object} data
|
||||
*/
|
||||
changeCoupon ( data ) {
|
||||
let _this = this;
|
||||
// uni.$off('couponItem')
|
||||
let couponData = JSON.parse(data)
|
||||
console.log('监听到事件来自返回的参数:' , couponData);
|
||||
_this.userCouponInfos = {
|
||||
userCouponId: couponData.id,
|
||||
discountAmount: couponData.discountAmount,
|
||||
num: 1,
|
||||
}
|
||||
console.log('监听到事件来自返回的参数:' , _this.favorable);
|
||||
if ( couponData.discountAmount < _this.listinfo.payAmount) {
|
||||
_this.listinfo.payAmount = _this.listinfo.payAmount - _this.userCouponInfos.discountAmount
|
||||
_this.favorable[0].value = ('-¥'+couponData.discountAmount)
|
||||
if ( couponData.type == 1 ) { //满减优惠券
|
||||
let couponList = _this.userCouponInfos.filter(v => v.type == 1);
|
||||
//不包含优惠券的金额
|
||||
let currentPayAmount = (couponList.length > 0 ? _this.listinfo.payAmount + couponList[0].discountAmount : _this.listinfo.payAmount)
|
||||
// 判断优惠金额不能大于支付金额
|
||||
if ( couponData.discountAmount < currentPayAmount) {
|
||||
_this.listinfo.payAmount = ( currentPayAmount - couponData.discountAmount).toFixed(2)
|
||||
_this.favorable[0].value = ('-¥'+couponData.discountAmount)
|
||||
if ( couponList.length > 0) {
|
||||
_this.userCouponInfos.map(item => {
|
||||
if ( item.type == 1 ) {
|
||||
item.userCouponId = couponData.id
|
||||
item.type = couponData.type
|
||||
item.discountAmount = couponData.discountAmount
|
||||
item.num = couponData.type == 1 ? 1 : couponData.num
|
||||
}
|
||||
})
|
||||
} else {
|
||||
_this.favorable[0].value = ('-¥'+couponData.discountAmount)
|
||||
_this.userCouponInfos.push({
|
||||
userCouponId: couponData.id,
|
||||
type: couponData.type,
|
||||
discountAmount: couponData.discountAmount,
|
||||
num: couponData.type == 1 ? 1 : couponData.num,
|
||||
})
|
||||
}
|
||||
if ( _this.isPointsChecked) {
|
||||
_this.pointsChange()
|
||||
_this.getCalcUsablePoints()
|
||||
}
|
||||
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: "优惠券满减金额大于订单金额不可使用",
|
||||
icon: "none",
|
||||
})
|
||||
}
|
||||
} else { //商品券
|
||||
// this.listinfo.details
|
||||
// 筛选选中商品券商品列表
|
||||
let couponList = _this.listinfo.details.filter(v => v.productId == couponData.proId);
|
||||
//金额从小到大排序
|
||||
let minCouponList = couponList.sort((a, b) => (a.memberPrice > 0 ? a.memberPrice : a.salePrice) - (b.memberPrice > 0 ? b.memberPrice : b.salePrice))
|
||||
let productTicketList = _this.userCouponInfos.filter(v => v.productId == couponData.proId);
|
||||
//商品券抵扣的数量
|
||||
let productNum = couponData.num;
|
||||
let productPayAmount = 0;
|
||||
let productTicketNum = 0;
|
||||
let productNumber = 0;
|
||||
productTicketList.map((item,index) => {
|
||||
productTicketNum += item.num
|
||||
})
|
||||
console.log(productTicketNum)
|
||||
minCouponList.map((item,index) => {
|
||||
productNumber += item.number
|
||||
if ( productNum > 0 && productNumber > productTicketNum) {
|
||||
let num = productNum >= item.number ? item.number : productNum
|
||||
productNum = (productNum - item.number) >= 0 ? (productNum - item.number) : 0;
|
||||
console.log(num)
|
||||
console.log(item.salePrice)
|
||||
productPayAmount = productPayAmount + (num*(item.memberPrice > 0 ? item.memberPrice : item.salePrice))
|
||||
}
|
||||
})
|
||||
console.log(minCouponList)
|
||||
_this.userCouponInfos.push({
|
||||
userCouponId: couponData.id,
|
||||
type: couponData.type,
|
||||
productId: couponData.proId,
|
||||
discountAmount: productPayAmount,
|
||||
num: productNum == 0 ? couponData.num : (couponData.num - productNum),
|
||||
})
|
||||
_this.favorable[1].value.push({
|
||||
userCouponId: couponData.id,
|
||||
name: couponData.name,
|
||||
type: couponData.type,
|
||||
productId: couponData.proId,
|
||||
discountAmount: productPayAmount,
|
||||
num: productNum == 0 ? couponData.num : (couponData.num - productNum),
|
||||
})
|
||||
|
||||
if ( _this.isPointsChecked) {
|
||||
_this.pointsChange()
|
||||
_this.getCalcUsablePoints()
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
// TODO 下面执行刷新的方法
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
uni.$off('couponItem')
|
||||
},
|
||||
setPayAmount ( cartLists ) {
|
||||
console.log(cartLists)
|
||||
let tableFee;
|
||||
if ( this.is_type == 0 ) {
|
||||
tableFee = this.shopTableInfo?(this.shopTableInfo.seatNum*this.storeInfo.tableFee):0
|
||||
@@ -332,6 +413,22 @@
|
||||
} else {
|
||||
this.listinfo.payAmount = (cartLists.amount+tableFee).toFixed(2)
|
||||
}
|
||||
if ( this.userCouponInfos.length > 0 ) {
|
||||
console.log(this.userCouponInfos)
|
||||
this.userCouponInfos.forEach(item => {
|
||||
if ( item.type == 1 ) {
|
||||
if ( item.discountAmount && item.discountAmount > 0 ) {
|
||||
this.listinfo.payAmount = (this.listinfo.payAmount - item.discountAmount).toFixed(2)
|
||||
}
|
||||
} else {
|
||||
if ( item.discountAmount && item.discountAmount > 0 ) {
|
||||
this.listinfo.payAmount = (this.listinfo.payAmount - item.discountAmount).toFixed(2)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
this.isPointsChecked = false;
|
||||
this.getCalcUsablePoints()
|
||||
},
|
||||
@@ -369,10 +466,27 @@
|
||||
goUrl(item){
|
||||
switch (item.type){
|
||||
case 'coupon':
|
||||
let payAmount = this.listinfo.payAmount;
|
||||
let couponList = this.userCouponInfos.filter(v => v.type == 1);
|
||||
if ( couponList.length > 0 ) {
|
||||
payAmount = payAmount + couponList.discountAmount;
|
||||
}
|
||||
uni.pro.navigateTo('/pages/user/coupon', {
|
||||
type: "confirm_order"
|
||||
type: "confirm_order_coupon",
|
||||
payAmount: payAmount,
|
||||
shoppingCart: JSON.stringify(this.listinfo.details)
|
||||
})
|
||||
break;
|
||||
case 'product':
|
||||
let productList = this.userCouponInfos.filter(v => v.type == 2);
|
||||
uni.pro.navigateTo('/pages/user/coupon', {
|
||||
type: "confirm_order_product",
|
||||
payAmount: this.listinfo.payAmount,
|
||||
shoppingCart: JSON.stringify(this.listinfo.details),
|
||||
productList: JSON.stringify(productList)
|
||||
})
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
@@ -390,7 +504,6 @@
|
||||
if ( this.calcUsablePointsData.usable && this.listinfo.payAmount >= this.calcUsablePointsData.minPaymentAmount) {
|
||||
this.calcUsablePointsData.pointsNum = this.calcUsablePointsData.accountPoints >= this.calcUsablePointsData.maxUsablePoints ? this.calcUsablePointsData.maxUsablePoints : this.calcUsablePointsData.accountPoints
|
||||
}
|
||||
console.log(this.calcUsablePointsData)
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -421,7 +534,6 @@
|
||||
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)
|
||||
@@ -552,7 +664,6 @@
|
||||
if ( this.shopTableInfo && this.shopTableInfo.seatNum ) { params.num = this.shopTableInfo.seatNum; }
|
||||
let res = await this.api.choseEatModel(params)
|
||||
|
||||
console.log(index)
|
||||
if ( type == 'tabClick') {
|
||||
if ( index == 1 ) {
|
||||
if ( res.data.info.length > 0) {
|
||||
@@ -697,7 +808,6 @@
|
||||
params.userCouponInfos = this.userCouponInfos
|
||||
}
|
||||
let res = await this.api.creatOrder(params)
|
||||
console.log(res)
|
||||
this.listinfoid = res.data.id;
|
||||
if ( this.storeInfo.registerType == 'restaurant') {
|
||||
uni.redirectTo({
|
||||
@@ -1274,7 +1384,9 @@
|
||||
justify-content: space-between;
|
||||
padding: 0 30rpx;
|
||||
box-sizing: border-box;
|
||||
margin-bottom: 32rpx;
|
||||
padding-bottom: 26rpx;
|
||||
padding-top: 26rpx;
|
||||
border-bottom: 2rpx solid #E5E5E5;
|
||||
.favorable_left{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -1299,6 +1411,30 @@
|
||||
}
|
||||
|
||||
}
|
||||
.favorable_right.column{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
.favorable_right_text{
|
||||
margin-bottom: 10rpx;
|
||||
text:nth-child(1){
|
||||
font-size: 26rpx;
|
||||
color: #999;
|
||||
}
|
||||
text:nth-child(2){
|
||||
font-size: 26rpx;
|
||||
color: #999;
|
||||
margin: 0 30rpx;
|
||||
}
|
||||
text:nth-child(3){
|
||||
font-size: 26rpx;
|
||||
color: #333;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.favorable.column{
|
||||
align-items: flex-start;
|
||||
}
|
||||
.cell-item{
|
||||
display: flex;
|
||||
@@ -1327,11 +1463,13 @@
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.totalPrice{
|
||||
padding: 32rpx 30rpx;
|
||||
box-sizing: border-box;
|
||||
border-top: 2rpx solid #E5E5E5;
|
||||
// border-top: 2rpx solid #E5E5E5;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: flex-end;
|
||||
|
||||
@@ -153,11 +153,17 @@
|
||||
})
|
||||
if (res.code == 0) {
|
||||
this.listinfo = res.data;
|
||||
console.log(this.listinfo.orderInfo.couponInfoList)
|
||||
if ( this.listinfo.orderInfo.couponInfoList ) {
|
||||
this.listinfo.orderInfo.couponInfoList = JSON.parse(this.listinfo.orderInfo.couponInfoList)
|
||||
// this.listinfo.orderInfo.couponInfoList = eval('(' + jsonString + ')')
|
||||
}
|
||||
this.listinfoid = res.data.orderId;
|
||||
this.shopId = res.data.shopId;
|
||||
if (this.listinfo.useType == " ") {
|
||||
//堂食先付费
|
||||
}
|
||||
console.log(this.listinfo)
|
||||
this.getAount();
|
||||
}
|
||||
},
|
||||
|
||||
@@ -4,14 +4,14 @@
|
||||
<view class="info">
|
||||
<view class="info_content">
|
||||
<image class="img" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/points/points_img1.png" mode="aspectFill"/>
|
||||
<viwe class="tips">可用积分</viwe>
|
||||
<viwe class="pnintsNum">{{pointsInfo.accountPoints}}</viwe>
|
||||
<viwe class="bottom">
|
||||
<view class="tips">可用积分</view>
|
||||
<view class="pnintsNum">{{pointsInfo.accountPoints}}</view>
|
||||
<view class="bottom">
|
||||
<view @click="tapClick(item)" v-for="(item,index) in tap" :key="index">
|
||||
<image class="icon" :src="item.iconUrl" mode="aspectFill" />
|
||||
<view>{{item.name}}</view>
|
||||
</view>
|
||||
</viwe>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="list"
|
||||
|
||||
Reference in New Issue
Block a user