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 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>
@ -77,7 +78,8 @@
<view style="color: #666666;font-size: 14px;">{{value}}件商品合计:</view>
<view style="color: red;"> <text style="font-weight: bold;font-size: 20px;">{{allPoints}}</text> 积分
</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>
@ -91,7 +93,7 @@
<view class="">
<view style="color: red;">
<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 style="color: #9d9d9d; font-size: 12px; ">积分账户{{myPoints}}</view>
</view>
@ -118,6 +120,7 @@
return {
myPoints: 0, //
goodsInfo: '',
flag: false, //
title: '',
qhindex: 0,
value: 1,
@ -125,7 +128,7 @@
allPoints: 0,
allAmout: 0,
addrInfo: {
address: '请填写地址'
address: ''
},
tapList: [{
@ -145,27 +148,30 @@
onLoad() {
uni.$on('goodsInfo', (data) => {
this.goodsInfo = data
console.log("from 11", data)
if (this.goodsInfo != null) {
this.dataProcessing()
this.allData()
}
})
uni.$emit('un')
},
onShow() {
uni.$on('chooseAddr', (data) => {
this.addrInfo = data
})
uni.$emit('unChooseAddr')
if (this.addrInfo == '' || this.addrInfo == null) {
if (this.addrInfo.address == '' || this.addrInfo == null) {
this.getAddr()
}
//
this.getUserInfoList()
this.transferIndex(0)
},
@ -183,10 +189,36 @@
},
valChange(e) {
// remaining_inventory
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) {
this.qhindex = index
// this.qhindex = index
const deliveryData = JSON.parse(this.goodsInfo.deliveryMethod);
console.log("deliveryData", deliveryData)
if (deliveryData.length >= 2) {
this.qhindex = index
} else if (deliveryData[0] == '到店自提') {
this.qhindex = 0
} else if (deliveryData[0] == '物流配送') {
this.qhindex = 1
}
},
goAdd() {
uni.navigateTo({
@ -198,30 +230,64 @@
},
//
allData() {
console.log("hhhhhhhhhhhhhhhhhhhhhhhhh")
this.allPoints = 0
this.allAmout = 0
let allPoints = new BigNumber(this.goodsInfo.exchangePoints)
let allAmout = new BigNumber(this.goodsInfo.exchangeAmount)
//
if (this.value < 1) {
this.value = 1
}
// if (this.value < 1) {
// this.value = 1
// }
let value = new BigNumber(this.value)
allPoints = allPoints.times(value)
console.log("allPoints", allPoints)
if (this.goodsInfo.exchangeMethod == '积分+金额') {
let allAmout = new BigNumber(this.goodsInfo.exchangeAmount)
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.allAmout = Number(allAmout).toFixed(2);
},
@ -248,13 +314,28 @@
request({
url: '/business/userManager/user/getByUniApp',
method: 'get',
// params:{}
params: {
chainStoreId: uni.getStorageSync('chainStoreId')
}
}).then((res) => {
if (res.code == 200) {
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>