商品兑换券更新
This commit is contained in:
parent
d2dbfd5163
commit
8c5e03d6c4
|
|
@ -155,9 +155,12 @@ export default {
|
|||
locationdistrict(data) { //获取行政区域(区,街道)
|
||||
return uni.api.get("/location/district", data);
|
||||
},
|
||||
queryMemberAccount(data) { //获取行政区域(区,街道)
|
||||
queryMemberAccount(data) { //获取余额明细
|
||||
return uni.api.get("/pay/queryMemberAccount", data);
|
||||
},
|
||||
queryMemberPointsLog(data) { //获取余额明细
|
||||
return uni.api.get("/api/points/member-points-log/page", data);
|
||||
},
|
||||
ordermineCoupons(data) { //我的优惠券
|
||||
return uni.api.get("/order/mineCoupons", data, false);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -6,10 +6,10 @@ const proxyApi = "/api"
|
|||
// const proxyApi = 'http://192.168.1.15:9888/cashierService' // 王伟
|
||||
// const proxyApi = 'http://192.168.1.27:9888/cashierService' // 帆哥
|
||||
// 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://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,7 +8,7 @@
|
|||
</view>
|
||||
<view class="bildRight">
|
||||
<text>我的积分</text>
|
||||
<view>{{info.levelConsume}}</view>
|
||||
<view>{{info.accountPoints}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="navTop">
|
||||
|
|
@ -26,14 +26,16 @@
|
|||
<view class="flex-start">
|
||||
<view class="listStyle_left">
|
||||
<view class="listrigth">
|
||||
<view>{{item.biz_name}}</view>
|
||||
<view :class="[item.type == '+'?'colorStyle':'']">{{item.type}}{{item.amount}}
|
||||
<view>{{active == 1 ? item.biz_name : item.memberName}}</view>
|
||||
<view :class="[item.type == '+'?'colorStyle':'']">
|
||||
{{ active == 1 ? item.type : (item.floatType == 'add'?'+':'')}}
|
||||
{{active == 1 ? item.amount : item.floatPoints}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="listrigth2">
|
||||
<view>{{$u.timeFormat(item.create_time, 'yyyy-mm-dd hh:MM:ss')}}</view>
|
||||
<view>余额:{{item.balance}}</view>
|
||||
<view v-if="active == 1">余额:{{item.balance}}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
|
@ -53,13 +55,15 @@
|
|||
pageSize: 10,
|
||||
memberId: null
|
||||
},
|
||||
info: null
|
||||
info: null,
|
||||
shopId: null
|
||||
}
|
||||
},
|
||||
onLoad(e) {
|
||||
console.log(JSON.parse(e.shopUserInfo))
|
||||
this.info = JSON.parse(e.shopUserInfo)
|
||||
this.form.memberId = this.info.id;
|
||||
this.shopId = this.info.shopId;
|
||||
this.getlist()
|
||||
},
|
||||
onReachBottom() {
|
||||
|
|
@ -73,20 +77,29 @@
|
|||
},
|
||||
async getlist() {
|
||||
if (this.active == 1) {
|
||||
let res = await this.api.queryMemberAccount(this.form)
|
||||
let res = await this.api.queryMemberAccount({
|
||||
...this.form
|
||||
})
|
||||
if (res.code == 0 && res.data.list.length > 0) {
|
||||
console.log(this.list.length)
|
||||
this.list = this.list.concat(res.data.list)
|
||||
this.form.page++
|
||||
console.log(this.list)
|
||||
}
|
||||
} else {
|
||||
this.list = []
|
||||
|
||||
let res = await this.api.queryMemberPointsLog({
|
||||
shopId: this.shopId,
|
||||
...this.form
|
||||
})
|
||||
if (res.code == 0 && res.data.list.length > 0) {
|
||||
this.list = this.list.concat(res.data.list)
|
||||
this.form.page++
|
||||
}
|
||||
}
|
||||
},
|
||||
clickEvent(i) {
|
||||
this.active = i;
|
||||
this.form.page = 1;
|
||||
this.list = []
|
||||
this.getlist()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -135,7 +135,9 @@
|
|||
type: 'index',
|
||||
})
|
||||
} else if ( type == 3 ) {
|
||||
uni.pro.navigateTo('user/coupon')
|
||||
uni.pro.navigateTo('user/coupon', {
|
||||
shopId: this.shopId,
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -715,6 +715,7 @@
|
|||
"skuId": this.skuId,
|
||||
"num": num, //数量
|
||||
"type": a == '+' ? 1 : 0,
|
||||
"isVip": item.isVip,
|
||||
"productId": item.id, //商品id
|
||||
"shopId": this.shopId,
|
||||
"note": item.note,
|
||||
|
|
@ -966,11 +967,12 @@
|
|||
let res = await this.api.productqueryProductSku({
|
||||
code: this.tableCode,
|
||||
shopId: this.shopId,
|
||||
"isVip": 0,
|
||||
isVip: item.isVip, //商品id
|
||||
productId: item.id, //商品id
|
||||
spec_tag: this.skuidname.join(","),
|
||||
})
|
||||
this.salePrice = res.data.salePrice // 价格
|
||||
|
||||
this.salePrice = this.isVip == 1 && res.data.memberPrice > 0 ? res.data.memberPrice : res.data.salePrice // 价格
|
||||
let data = null;
|
||||
if (a == 1) { //1添加购物车 2是websocket返回这个商品的价格(应为不同的多规格商品返回不同的价格)
|
||||
let params = {
|
||||
|
|
@ -979,7 +981,7 @@
|
|||
"type": c == '+' ? 1 : 0,
|
||||
"productId": item.id, //商品id
|
||||
"note": item.note,
|
||||
"isVip": 0,
|
||||
"isVip": item.isVip,
|
||||
"shopId": this.shopId,
|
||||
"userId": uni.cache.get('userInfo').id,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,14 +95,17 @@
|
|||
status: 1,
|
||||
type: "",
|
||||
payAmount: 0,
|
||||
shopId: null,
|
||||
shoppingCart: [],
|
||||
productList: [],
|
||||
|
||||
};
|
||||
},
|
||||
onLoad(options) {
|
||||
console.log(options)
|
||||
if (options.type) { this.type = options.type }
|
||||
if (options.payAmount) { this.payAmount = options.payAmount }
|
||||
if (options.shopId) { this.shopId = options.shopId }
|
||||
if (options.shoppingCart) { this.shoppingCart = JSON.parse(decodeURIComponent(options.shoppingCart)) }
|
||||
if (options.productList) { this.productList = JSON.parse(decodeURIComponent(options.productList)) }
|
||||
},
|
||||
|
|
@ -128,12 +131,14 @@
|
|||
try {
|
||||
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;
|
||||
}
|
||||
if ( this.shopId ) {
|
||||
params.shopId = this.shopId;
|
||||
}
|
||||
console.log("params",params)
|
||||
let res = await this.api.conponList(params)
|
||||
if (res.code == 0) {
|
||||
|
|
|
|||
|
|
@ -207,7 +207,7 @@
|
|||
})
|
||||
setTimeout(()=>{
|
||||
uni.pro.redirectTo('/pages/user/coupon', {
|
||||
type: 1
|
||||
type: 1,
|
||||
})
|
||||
},1000)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@
|
|||
</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>
|
||||
<u-icon name="arrow-right" color="#575B66" size="28" v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'"></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">
|
||||
|
|
@ -69,7 +69,7 @@
|
|||
<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>
|
||||
<u-icon v-if="item.value.length <= 0 && (listinfo.status == 'unpaid' || listinfo.status == 'paying')" 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">
|
||||
|
|
@ -211,7 +211,12 @@
|
|||
_this.pointsChange()
|
||||
_this.getCalcUsablePoints()
|
||||
}
|
||||
this.$emit("setPayAmount",_this.listinfo.payAmount)
|
||||
this.$emit("setPayAmount",{
|
||||
payAmount: this.listinfo.payAmount,
|
||||
userCouponInfos: this.userCouponInfos,
|
||||
calcUsablePointsData: this.calcUsablePointsData,
|
||||
isPointsChecked: this.isPointsChecked,
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: "优惠券满减金额大于订单金额不可使用",
|
||||
|
|
@ -219,7 +224,8 @@
|
|||
})
|
||||
}
|
||||
} else { //商品券
|
||||
|
||||
//不包含商品券的金额
|
||||
let currentPayAmount = 0;
|
||||
// 筛选选中商品券商品列表
|
||||
let couponList = _this.listinfo.details.filter(v => v.productId == couponData.proId);
|
||||
//金额从小到大排序
|
||||
|
|
@ -227,31 +233,43 @@
|
|||
let productTicketList = _this.userCouponInfos.filter(v => v.productId == couponData.proId);
|
||||
//商品券抵扣的数量
|
||||
let productNum = couponData.num;
|
||||
// 使用数量
|
||||
let num = 0;
|
||||
let productPayAmount = 0;
|
||||
let productTicketNum = 0;
|
||||
let productNumber = 0;
|
||||
productTicketList.map((item,index) => {
|
||||
console.log(item)
|
||||
productTicketNum += item.num
|
||||
_this.listinfo.payAmount = Number(_this.listinfo.payAmount) + item.discountAmount
|
||||
})
|
||||
console.log(productTicketList)
|
||||
console.log(minCouponList)
|
||||
console.log(productTicketNum)
|
||||
let productTicketNumber = 0;
|
||||
minCouponList.map((item,index) => {
|
||||
// productNumber += item.num
|
||||
if ( productNum > 0) {
|
||||
item.num = (item.num - productTicketNum) <= 0 ? 0 : (item.num - productTicketNum)
|
||||
console.log("productTicketNum==",productTicketNum)
|
||||
if ( productNum > 0 && productTicketNum > 0) {
|
||||
productTicketNumber = productTicketNum
|
||||
productTicketNum = (item.num - productTicketNum) <= 0 ? (productTicketNum - item.num) : item.num - productTicketNum
|
||||
console.log(productTicketNum)
|
||||
console.log("item.num - productTicketNumber===",item.num - productTicketNumber)
|
||||
|
||||
}
|
||||
if ( productNum > 0 && productTicketNum > 0) {
|
||||
item.num = (item.num - productTicketNumber) <= 0 ? 0 : (item.num - productTicketNumber)
|
||||
}
|
||||
console.log("productTicketNum==",productTicketNum)
|
||||
console.log("item.num===",item.num)
|
||||
if ( productNum > 0 && item.num > 0) {
|
||||
console.log("index===",index)
|
||||
let num = productNum >= item.num ? item.num : productNum
|
||||
productNum = (productNum - item.num) >= 0 ? (productNum - item.num) : 0;
|
||||
productPayAmount = productPayAmount + (num*(item.memberPrice > 0 ? item.memberPrice : item.price))
|
||||
// let num = productNum >= item.num ? item.num : productNum
|
||||
// productNum = (productNum - item.num) >= 0 ? (productNum - item.num) : 0;
|
||||
|
||||
// productNum = num <= productNum ? num : productNum;
|
||||
productPayAmount = productPayAmount + (num*(item.memberPrice > 0 ? item.memberPrice : item.price))
|
||||
}
|
||||
})
|
||||
if ( productPayAmount > _this.listinfo.payAmount) {
|
||||
|
||||
}
|
||||
_this.userCouponInfos.push({
|
||||
userCouponId: couponData.id,
|
||||
type: couponData.type,
|
||||
|
|
@ -268,11 +286,11 @@
|
|||
num: productNum == 0 ? couponData.num : (couponData.num - productNum),
|
||||
})
|
||||
console.log(productNum)
|
||||
console.log(productNum == 0 ? couponData.num : productNum)
|
||||
if ( _this.isPointsChecked) {
|
||||
_this.pointsChange()
|
||||
}
|
||||
this.setPayAmount()
|
||||
}
|
||||
|
||||
_this.setPayAmount()
|
||||
}
|
||||
uni.$off('couponItem')
|
||||
},
|
||||
|
|
@ -285,9 +303,9 @@
|
|||
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)
|
||||
}
|
||||
// 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)
|
||||
|
|
@ -299,7 +317,12 @@
|
|||
|
||||
this.isPointsChecked = false;
|
||||
this.getCalcUsablePoints()
|
||||
this.$emit("setPayAmount",this.listinfo.payAmount)
|
||||
this.$emit("setPayAmount",{
|
||||
payAmount: this.listinfo.payAmount,
|
||||
userCouponInfos: this.userCouponInfos,
|
||||
calcUsablePointsData: this.calcUsablePointsData,
|
||||
isPointsChecked: this.isPointsChecked,
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 积分状态监听
|
||||
|
|
@ -318,34 +341,45 @@
|
|||
this.listinfo.payAmount = (Number(this.listinfo.payAmount)+(this.calcUsablePointsData.pointsNum/this.calcUsablePointsData.equivalentPoints)).toFixed(2);
|
||||
}
|
||||
console.log(this.listinfo.payAmount)
|
||||
this.$emit("setPayAmount",this.listinfo.payAmount)
|
||||
this.$emit("setPayAmount",{
|
||||
payAmount: this.listinfo.payAmount,
|
||||
userCouponInfos: this.userCouponInfos,
|
||||
calcUsablePointsData: this.calcUsablePointsData,
|
||||
isPointsChecked: this.isPointsChecked,
|
||||
})
|
||||
},
|
||||
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;
|
||||
if ( this.listinfo.status == 'unpaid' || this.listinfo.status == 'paying') {
|
||||
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",
|
||||
shopId: this.listinfo.shopId,
|
||||
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",
|
||||
shopId: this.listinfo.shopId,
|
||||
payAmount: this.listinfo.payAmount,
|
||||
shoppingCart: JSON.stringify(this.listinfo.details),
|
||||
productList: JSON.stringify(productList)
|
||||
})
|
||||
break;
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -472,8 +472,10 @@
|
|||
if ( couponList.length > 0 ) {
|
||||
payAmount = payAmount + couponList.discountAmount;
|
||||
}
|
||||
|
||||
uni.pro.navigateTo('/pages/user/coupon', {
|
||||
type: "confirm_order_coupon",
|
||||
shopId: this.shopId,
|
||||
payAmount: payAmount,
|
||||
shoppingCart: JSON.stringify(this.listinfo.details)
|
||||
})
|
||||
|
|
@ -482,6 +484,7 @@
|
|||
let productList = this.userCouponInfos.filter(v => v.type == 2);
|
||||
uni.pro.navigateTo('/pages/user/coupon', {
|
||||
type: "confirm_order_product",
|
||||
shopId: this.shopId,
|
||||
payAmount: this.listinfo.payAmount,
|
||||
shoppingCart: JSON.stringify(this.listinfo.details),
|
||||
productList: JSON.stringify(productList)
|
||||
|
|
|
|||
|
|
@ -92,6 +92,7 @@
|
|||
listinfoid: null,
|
||||
status: [],
|
||||
amountVIP: null,
|
||||
couopnInfo: null,
|
||||
srcimge: 'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/wx.jpg'
|
||||
};
|
||||
},
|
||||
|
|
@ -120,11 +121,10 @@
|
|||
console.log(e)
|
||||
},
|
||||
methods: {
|
||||
setPayAmount(payAmount) {
|
||||
console.log("payAmount===",payAmount)
|
||||
this.listinfo.payAmount = payAmount
|
||||
// this.$set(this.listinfo,"payAmount",payAmount)
|
||||
// this.$forceUpdate()
|
||||
setPayAmount(data) {
|
||||
console.log(data)
|
||||
this.listinfo.payAmount = data.payAmount
|
||||
this.couopnInfo = data;
|
||||
},
|
||||
saveImage (url) {
|
||||
uni.saveImage({
|
||||
|
|
@ -369,6 +369,16 @@
|
|||
let res = await this.api.paymodfiyOrderInfo({
|
||||
orderId: this.listinfo.orderId,
|
||||
})
|
||||
// this.couopnInfo
|
||||
let params = {
|
||||
shopId: this.listinfo.shopId,
|
||||
orderId: this.listinfo.orderId,
|
||||
userCouponInfos: this.couopnInfo.userCouponInfos,
|
||||
}
|
||||
if ( this.couopnInfo.isPointsChecked && this.couopnInfo.calcUsablePointsData.pointsNum && this.couopnInfo.calcUsablePointsData.pointsNum > 0) {
|
||||
params.pointsNum = this.couopnInfo.calcUsablePointsData.pointsNum;
|
||||
}
|
||||
let ress = await this.api.useCoupon(params)
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue