Commit 0f157558 by 谢中龙

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

parent 773ae075
...@@ -93,7 +93,6 @@ Component({ ...@@ -93,7 +93,6 @@ Component({
wxService.get(`/merchant/brandSwitchSetting/getOpenStatus?businessType=2`).then(res => { wxService.get(`/merchant/brandSwitchSetting/getOpenStatus?businessType=2`).then(res => {
const { result, data } = res.data const { result, data } = res.data
if (result == 0) { if (result == 0) {
console.log(data)
if(data){ if(data){
this.getLevelList(); this.getLevelList();
} }
...@@ -110,7 +109,6 @@ Component({ ...@@ -110,7 +109,6 @@ Component({
//获取等级列表 //获取等级列表
getLevelList(){ getLevelList(){
wxService.post('/merchant/settingLevel/get').then(res => { wxService.post('/merchant/settingLevel/get').then(res => {
console.log(res)
if(res){ if(res){
let levelList = res.data.data ? res.data.data : []; let levelList = res.data.data ? res.data.data : [];
if (levelList.length == 0){ if (levelList.length == 0){
...@@ -119,7 +117,6 @@ Component({ ...@@ -119,7 +117,6 @@ Component({
}) })
} }
else{ else{
console.log(this.data)
let index = this.data.baseUserInfo.member.level ? this.data.baseUserInfo.member.level : 0; let index = this.data.baseUserInfo.member.level ? this.data.baseUserInfo.member.level : 0;
let filterLevel = levelList.filter(item => item.index == index); let filterLevel = levelList.filter(item => item.index == index);
if (filterLevel.length > 0){ if (filterLevel.length > 0){
......
...@@ -93,21 +93,14 @@ Component({ ...@@ -93,21 +93,14 @@ Component({
productStock:{ productStock:{
type: Number, type: Number,
value: 0 value: 0
},
productPrice:{
type: Number,
value: 0
} }
}, },
attached () { 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({ ...@@ -117,7 +110,7 @@ Component({
curSpec: [], // 当前选中的规格值 curSpec: [], // 当前选中的规格值
curSku: {}, // 当前选中的sku信息 curSku: {}, // 当前选中的sku信息
// price: 0, // 页面上展示的价格 // price: 0, // 页面上展示的价格
skuText: '', skuText: [],
skuStock: 0, skuStock: 0,
skuId:'', skuId:'',
btnText: '确定', // 确定 缺货 缺货订阅 btnText: '确定', // 确定 缺货 缺货订阅
...@@ -133,33 +126,26 @@ Component({ ...@@ -133,33 +126,26 @@ Component({
this._skuInfosChange = null 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: { 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() { confirm() {
if (this.data.curSpec.length < 1){ if (this.data.curSpec.length < 1){
wx.showToast({ wx.showToast({
...@@ -203,7 +189,7 @@ Component({ ...@@ -203,7 +189,7 @@ Component({
this.setData({ this.setData({
curSpec: [], // 当前选中的规格值 curSpec: [], // 当前选中的规格值
curSku: {}, // 当前选中的sku信息 curSku: {}, // 当前选中的sku信息
skuStock : 0, skuStock : this.data.productStock,
}); });
// this.triggerEvent('skuselect', { // this.triggerEvent('skuselect', {
// selectSku: this.data.curSku, // selectSku: this.data.curSku,
...@@ -308,16 +294,6 @@ Component({ ...@@ -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信息 _setCurSku: function () { // 显示选中的sku信息
if (!this.data.skuInfos) { if (!this.data.skuInfos) {
return false return false
......
...@@ -25,7 +25,8 @@ ...@@ -25,7 +25,8 @@
<view class="price-text">¥{{utils.numberFormat(salePrice /100)}}</view> <view class="price-text">¥{{utils.numberFormat(salePrice /100)}}</view>
<view class="stock-text">库存:{{skuStock}}</view> <view class="stock-text">库存:{{skuStock}}</view>
<view class="sku-text">规格: <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> </view>
</view> </view>
......
...@@ -107,8 +107,10 @@ ...@@ -107,8 +107,10 @@
padding: 0 39rpx; padding: 0 39rpx;
display: inline-block; display: inline-block;
border-radius: 10rpx; border-radius: 10rpx;
background-color: rgba(238, 238, 238, 1); /* background-color: rgba(238, 238, 238, 1); */
background: #ffffff;
margin: 25rpx 23rpx 25rpx 0; margin: 25rpx 23rpx 25rpx 0;
border: solid 1rpx #dddddd;
} }
.mid-info .sku-info .spec-value.disabled { .mid-info .sku-info .spec-value.disabled {
......
...@@ -190,6 +190,7 @@ ...@@ -190,6 +190,7 @@
good-type="{{productInfo.productType}}" good-type="{{productInfo.productType}}"
index-img="{{productInfo.indexUrl}}" index-img="{{productInfo.indexUrl}}"
sku-infos="{{productInfo.productSku}}" sku-infos="{{productInfo.productSku}}"
product-price="{{productInfo.plusPrice ? productInfo.plusPrice : productInfo.minSalePrice}}"
show="{{showSkuPopup}}" show="{{showSkuPopup}}"
bind:skuselect="confirmClick" bind:skuselect="confirmClick"
btn-text="{{btnText}}" 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