no message

This commit is contained in:
wangh 2023-12-05 10:38:56 +08:00
parent 2937f621fc
commit 8163e11ded

View File

@ -67,7 +67,8 @@
</view> </view>
<view class=""> <view class="">
<u-number-box v-model="value" @change="valChange" button-size="18"></u-number-box> <u-number-box v-model="value" @change="valChange" button-size="18"
:disablePlus="flag"></u-number-box>
</view> </view>
</view> </view>
@ -77,7 +78,8 @@
<view style="color: #666666;font-size: 14px;">{{value}}件商品合计:</view> <view style="color: #666666;font-size: 14px;">{{value}}件商品合计:</view>
<view style="color: red;"> <text style="font-weight: bold;font-size: 20px;">{{allPoints}}</text> 积分 <view style="color: red;"> <text style="font-weight: bold;font-size: 20px;">{{allPoints}}</text> 积分
</view> </view>
<view style="color: red;"> <text style="font-weight: bold;font-size: 20px;">+{{allAmout}}</text> <view v-if="allAmout>0" style="color: red;"> <text
style="font-weight: bold;font-size: 20px;">+{{allAmout}}</text>
</view> </view>
</view> </view>
</view> </view>
@ -91,7 +93,7 @@
<view class=""> <view class="">
<view style="color: red;"> <view style="color: red;">
<text style="font-weight: bold;font-size: 20px;">{{allPoints}}</text> 积分 <text style="font-weight: bold;font-size: 20px;">{{allPoints}}</text> 积分
<text style="font-weight: bold;font-size: 20px;">+{{allAmout}}</text> <text v-if="allAmout>0" style="font-weight: bold;font-size: 20px;">+{{allAmout}}</text>
</view> </view>
<view style="color: #9d9d9d; font-size: 12px; ">积分账户{{myPoints}}</view> <view style="color: #9d9d9d; font-size: 12px; ">积分账户{{myPoints}}</view>
</view> </view>
@ -118,6 +120,7 @@
return { return {
myPoints: 0, // myPoints: 0, //
goodsInfo: '', goodsInfo: '',
flag: false, //
title: '', title: '',
qhindex: 0, qhindex: 0,
value: 1, value: 1,
@ -125,7 +128,7 @@
allPoints: 0, allPoints: 0,
allAmout: 0, allAmout: 0,
addrInfo: { addrInfo: {
address: '请填写地址' address: ''
}, },
tapList: [{ tapList: [{
@ -145,27 +148,30 @@
onLoad() { onLoad() {
uni.$on('goodsInfo', (data) => { uni.$on('goodsInfo', (data) => {
this.goodsInfo = data this.goodsInfo = data
console.log("from 11", data)
if (this.goodsInfo != null) { if (this.goodsInfo != null) {
this.dataProcessing() this.dataProcessing()
this.allData() this.allData()
} }
}) })
uni.$emit('un') uni.$emit('un')
}, },
onShow() { onShow() {
uni.$on('chooseAddr', (data) => { uni.$on('chooseAddr', (data) => {
this.addrInfo = data this.addrInfo = data
}) })
uni.$emit('unChooseAddr') uni.$emit('unChooseAddr')
if (this.addrInfo == '' || this.addrInfo == null) { if (this.addrInfo.address == '' || this.addrInfo == null) {
this.getAddr() this.getAddr()
} }
// //
this.getUserInfoList() this.getUserInfoList()
this.transferIndex(0)
}, },
@ -183,10 +189,36 @@
}, },
valChange(e) { valChange(e) {
// remaining_inventory
console.log('当前值为: ' + e.value) console.log('当前值为: ' + e.value)
console.log('当前值为123: ' + this.goodsInfo.remainingInventory)
if (e.value >= this.goodsInfo.remainingInventory) {
e.value = this.goodsInfo.remainingInventory
this.value = this.goodsInfo.remainingInventory
this.flag = true
this.allData()
} else {
this.value = e.value
this.allData()
}
}, },
transferIndex(index) { transferIndex(index) {
// this.qhindex = index
const deliveryData = JSON.parse(this.goodsInfo.deliveryMethod);
console.log("deliveryData", deliveryData)
if (deliveryData.length >= 2) {
this.qhindex = index this.qhindex = index
} else if (deliveryData[0] == '到店自提') {
this.qhindex = 0
} else if (deliveryData[0] == '物流配送') {
this.qhindex = 1
}
}, },
goAdd() { goAdd() {
uni.navigateTo({ uni.navigateTo({
@ -198,30 +230,64 @@
}, },
// //
allData() { allData() {
console.log("hhhhhhhhhhhhhhhhhhhhhhhhh")
this.allPoints = 0 this.allPoints = 0
this.allAmout = 0 this.allAmout = 0
let allPoints = new BigNumber(this.goodsInfo.exchangePoints) let allPoints = new BigNumber(this.goodsInfo.exchangePoints)
let allAmout = new BigNumber(this.goodsInfo.exchangeAmount)
// //
if (this.value < 1) { // if (this.value < 1) {
this.value = 1 // this.value = 1
} // }
let value = new BigNumber(this.value) let value = new BigNumber(this.value)
allPoints = allPoints.times(value) allPoints = allPoints.times(value)
console.log("allPoints", allPoints)
if (this.goodsInfo.exchangeMethod == '积分+金额') { if (this.goodsInfo.exchangeMethod == '积分+金额') {
let allAmout = new BigNumber(this.goodsInfo.exchangeAmount)
allAmout = allAmout.times(value) allAmout = allAmout.times(value)
if (this.goodsInfo.exchangePoints < 0) {
allAmout = 0
}
this.allAmout = Number(allAmout).toFixed(2);
} }
//
console.log("hhhhhhhhhhhhhhhhhhhhhhhhh11", allPoints) if (this.goodsInfo.exchangeMethod === '积分+加钱购') {
//
let data = this.shoppingCart[0]; //
//
let markPurchases = new BigNumber(data.markPurchases);
let exchangePoints = allPoints.multipliedBy(new BigNumber(data.exchangePoints));
//
this.member.points = this.member.points ? this.member.points : 0
let points = this.myPoints - allPoints; // 使 toNumber() BigNumber
//
if (points < 0) {
//
points = Math.abs(points);
allAmout = points * this.goodsInfo.moneyRatio; // 使 JavaScript
this.allAmout = allAmout.toFixed(2);
// this.allAmout = Number(allAmout).toFixed(2);
} else {
this.allAmout = 0
this.allPoints = exchangePoints.toNumber();
}
return
}
// //
this.allPoints = Number(allPoints).toFixed(2); this.allPoints = Number(allPoints).toFixed(2);
this.allAmout = Number(allAmout).toFixed(2);
}, },
@ -248,13 +314,28 @@
request({ request({
url: '/business/userManager/user/getByUniApp', url: '/business/userManager/user/getByUniApp',
method: 'get', method: 'get',
// params:{} params: {
chainStoreId: uni.getStorageSync('chainStoreId')
}
}).then((res) => { }).then((res) => {
if (res.code == 200) { if (res.code == 200) {
this.myPoints = res.data.points this.myPoints = res.data.points
} }
}) })
}, },
// storeid
getStroeById() {
request({
url: 'business/storeInformation/store',
method: 'get',
// params:{}
}).then((res) => {
if (res.code == 200) {
this.myPoints = res.data.points
}
})
}
} }
} }
</script> </script>