Commit 0f157558 by 谢中龙

修改加入购物车初始价格和库存

parent 773ae075
......@@ -93,7 +93,6 @@ Component({
wxService.get(`/merchant/brandSwitchSetting/getOpenStatus?businessType=2`).then(res => {
const { result, data } = res.data
if (result == 0) {
console.log(data)
if(data){
this.getLevelList();
}
......@@ -110,7 +109,6 @@ Component({
//获取等级列表
getLevelList(){
wxService.post('/merchant/settingLevel/get').then(res => {
console.log(res)
if(res){
let levelList = res.data.data ? res.data.data : [];
if (levelList.length == 0){
......@@ -119,7 +117,6 @@ Component({
})
}
else{
console.log(this.data)
let index = this.data.baseUserInfo.member.level ? this.data.baseUserInfo.member.level : 0;
let filterLevel = levelList.filter(item => item.index == index);
if (filterLevel.length > 0){
......
......@@ -93,21 +93,14 @@ Component({
productStock:{
type: Number,
value: 0
},
productPrice:{
type: Number,
value: 0
}
},
attached () {
// let price = this.data.showPrice
// if (!price) {
// if (this.data.curSku.promotion_price) {
// price = this._setExchangePrice(this.data.curSku.promotion_price)
// }
// }
// console.log(this.data)
// this.setData({
// price
// })
},
/**
......@@ -117,7 +110,7 @@ Component({
curSpec: [], // 当前选中的规格值
curSku: {}, // 当前选中的sku信息
// price: 0, // 页面上展示的价格
skuText: '',
skuText: [],
skuStock: 0,
skuId:'',
btnText: '确定', // 确定 缺货 缺货订阅
......@@ -133,33 +126,26 @@ Component({
this._skuInfosChange = null
},
//监听函数
observers :{
productStock(val){
this.data.skuStock = val;
this.setData({
skuStock : this.data.skuStock
});
},
productPrice(val){
this.data.salePrice = val;
this.setData({
salePrice : this.data.salePrice
});
}
},
/**
* 组件的方法列表
*/
methods: {
// _skuInfosChange () {
// var curSpec = []
// if (this.data.initSku) {
// console.log(this.data.initSku)
// curSpec = this.data.initSku.spec.split('###')
// }
// this.setData({
// curSpec: curSpec, // 当前选中的规格值
// curSku: {}, // 当前选中的sku信息
// skuText: '',
// skuStock: 0,
// salePrice:0
// })
// this._setCurSku()
// },
// _showPriceChange (newV, oldV) {
// if (newV !== oldV) {
// this.setData({
// showPrice: newV,
// price: newV
// })
// }
// },
confirm() {
if (this.data.curSpec.length < 1){
wx.showToast({
......@@ -203,7 +189,7 @@ Component({
this.setData({
curSpec: [], // 当前选中的规格值
curSku: {}, // 当前选中的sku信息
skuStock : 0,
skuStock : this.data.productStock,
});
// this.triggerEvent('skuselect', {
// selectSku: this.data.curSku,
......@@ -308,16 +294,6 @@ Component({
}
},
// _setExchangePrice (price) {
// let exprice = price
// if (this.data.exchangePrice > 0) {
// let exchangePrice = this.data.exchangePrice// 积分数
// let bwtPrice = ((exchangePrice * this.data.integralRole - price) / 100)// 差额
// exprice = bwtPrice < 0 ? ((exchangePrice) + '积分+¥' + Math.abs(bwtPrice)) : (exchangePrice + '积分')
// }
// return exprice
// },
_setCurSku: function () { // 显示选中的sku信息
if (!this.data.skuInfos) {
return false
......
......@@ -25,7 +25,8 @@
<view class="price-text">¥{{utils.numberFormat(salePrice /100)}}</view>
<view class="stock-text">库存:{{skuStock}}</view>
<view class="sku-text">规格:
<block wx:for="{{skuText}}" wx:key="*this">{{item}} </block>
<block wx:if="{{skuText.length == 0}}">请选择规格</block>
<block wx:esle wx:for="{{skuText}}" wx:key="*this">{{item}} </block>
</view>
</view>
</view>
......
......@@ -107,8 +107,10 @@
padding: 0 39rpx;
display: inline-block;
border-radius: 10rpx;
background-color: rgba(238, 238, 238, 1);
/* background-color: rgba(238, 238, 238, 1); */
background: #ffffff;
margin: 25rpx 23rpx 25rpx 0;
border: solid 1rpx #dddddd;
}
.mid-info .sku-info .spec-value.disabled {
......
......@@ -190,6 +190,7 @@
good-type="{{productInfo.productType}}"
index-img="{{productInfo.indexUrl}}"
sku-infos="{{productInfo.productSku}}"
product-price="{{productInfo.plusPrice ? productInfo.plusPrice : productInfo.minSalePrice}}"
show="{{showSkuPopup}}"
bind:skuselect="confirmClick"
btn-text="{{btnText}}"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment