郑锦全 4 years ago
parent
commit
71bcece580
  1. 2
      src/subpackage/retail/components/hover_cart_list/hover_cart_list.vue
  2. 36
      src/subpackage/retail/pages/confirm_goods/confirm_goods.vue
  3. 97
      src/subpackage/retail/pages/index/index.vue
  4. 2
      src/subpackage/retail/pages/search/search.vue

2
src/subpackage/retail/components/hover_cart_list/hover_cart_list.vue

@ -19,7 +19,7 @@
</view>
<view class="hover-cart-list-dialog-content-col3">
<image mode="aspectFit" src="/static/images/icon/retail/sub.png" @click="cartCountClick('sub', item.id)"></image>
<view>{{ item.erp_goods_sale_total }}</view>
<view>{{ item.count }}</view>
<image mode="aspectFit" src="/static/images/icon/retail/add.png" @click="cartCountClick('add', item.id)"></image>
</view>
</view>

36
src/subpackage/retail/pages/confirm_goods/confirm_goods.vue

@ -19,7 +19,7 @@
</view>
<view class="final-cart-list-dialog-content-col3">
<image v-if="isEdited" mode="aspectFit" src="/static/images/icon/retail/sub.png" @click="cartCountClick('sub', item.id)"></image>
<view>{{ item.erp_goods_sale_total }}</view>
<view>{{ item.count }}</view>
<image v-if="isEdited" mode="aspectFit" src="/static/images/icon/retail/add.png" @click="cartCountClick('add', item.id)"></image>
</view>
</view>
@ -97,12 +97,12 @@
let _this = this;
let data = [];
for (let i = 0; i < this.cartListFinal.length; ++i) {
if (this.cartListFinal[i].erp_goods_sale_total) {
if (this.cartListFinal[i].count) {
data.push({
id: this.cartListFinal[i].id,
name: this.cartListFinal[i].erp_goods_name,
price: this.cartListFinal[i].erp_goods_price,
nums: this.cartListFinal[i].erp_goods_sale_total,
nums: this.cartListFinal[i].count,
unit: this.cartListFinal[i].erp_goods_unit,
});
}
@ -114,7 +114,7 @@
}
util.showLoad();
retailServer.get({
retailServer.post({
url: retailApi.assistantRetail,
data: {
store_id: _this.curStore.id,
@ -124,9 +124,21 @@
failMsg: '出库失败!'
}).then(res => {
if (res.data.code == 0) {
util.hideLoad();
uni.navigateBack({
delta: 1
uni.setStorage({
key: "retailStatus",
data: "true",
success: function() {
util.hideLoad();
uni.navigateBack({
delta: 1
});;
},
fail: function(err) {
util.hideLoad();
uni.navigateBack({
delta: 1
});
},
});
}
else {
@ -163,18 +175,18 @@
switch (type) {
case "add": {
//
if (item.erp_goods_sale_total + 1 > item.stock_num) {
if (item.count + 1 > item.stock_num) {
util.showNone("库存就这么多了!");
return;
}
item.erp_goods_sale_total += 1;
item.count += 1;
} break;
case "sub": {
if (item.erp_goods_sale_total <= 0) {
if (item.count <= 0) {
return;
}
item.erp_goods_sale_total -= 1;
item.count -= 1;
} break;
}
@ -187,7 +199,7 @@
let price = 0.0;
for (let i = 0; i < this.cartListFinal.length; ++i) {
price += (this.cartListFinal[i].erp_goods_sale_total * this.cartListFinal[i].erp_goods_price);
price += (this.cartListFinal[i].count * this.cartListFinal[i].erp_goods_price);
}
this.totalPrice = price.toFixed(2);

97
src/subpackage/retail/pages/index/index.vue

@ -46,8 +46,8 @@
</view>
<view class="main-right-list-count-row">
<image v-if="item.erp_goods_sale_total>0?true:false" mode="aspectFit" src="/static/images/icon/retail/sub.png" @click="mainCountClick('sub', scrollItem.cate.id, scrollItem.cate.erp_goods_cate_name, item.id)"></image>
<view v-if="item.erp_goods_sale_total>0?true:false">{{ item.erp_goods_sale_total }}</view>
<image v-if="item.count>0?true:false" mode="aspectFit" src="/static/images/icon/retail/sub.png" @click="mainCountClick('sub', scrollItem.cate.id, scrollItem.cate.erp_goods_cate_name, item.id)"></image>
<view v-if="item.count>0?true:false">{{ item.count }}</view>
<image mode="aspectFit" src="/static/images/icon/retail/add.png" @click="mainCountClick('add', scrollItem.cate.id, scrollItem.cate.erp_goods_cate_name, item.id)"></image>
</view>
</view>
@ -132,8 +132,38 @@ export default {
},
onShow() {
this.getSearchLocal(); //
this.getRetailStatus(); //
},
methods: {
//
getRetailStatus() {
let _this = this;
uni.getStorage({
key: 'retailStatus',
success: function (res) {
_this.getGoodsInfo(); //
_this.deleteRetailLocal(); //
},
fail: function(err) {
console.log(err);
_this.deleteRetailLocal(); //
},
});
},
//
deleteRetailLocal() {
this.searchData = null;
uni.removeStorage({
key: 'retailStatus',
success: function (res) {
console.log('success');
}
});
},
//
categoryOnScroll(e) {
this.categoryOldScrollTop = e.detail.scrollTop;
@ -159,6 +189,7 @@ export default {
for (let i = 0; i < data.length; ++i) {
if (data[i].goods_list) {
for (let j = 0; j < data[i].goods_list.length; ++j) {
data[i].goods_list[j].count = 0; //
tempData["" + data[i].goods_list[j].id] = data[i].goods_list[j];
}
}
@ -178,7 +209,7 @@ export default {
for (let i = 0; i < this.goodsInfo[0].goods_list.length; ++i) {
for (let j = 0; j < otherData.length; ++j) {
if (this.goodsInfo[0].goods_list[i].id == otherData[j].id) {
this.goodsInfo[0].goods_list[i].erp_goods_sale_total = otherData[j].erp_goods_sale_total;
this.goodsInfo[0].goods_list[i].count = otherData[j].count;
}
}
}
@ -241,8 +272,8 @@ export default {
let count = 0;
for (let i = 0; i < this.cartList.length; ++i) {
price += (this.cartList[i].erp_goods_sale_total * this.cartList[i].erp_goods_price);
count += this.cartList[i].erp_goods_sale_total;
price += (this.cartList[i].count * this.cartList[i].erp_goods_price);
count += this.cartList[i].count;
}
this.cartTotalPrice = price.toFixed(2);
@ -265,24 +296,24 @@ export default {
switch (type) {
case "add": {
//
if (this.cartList[i].erp_goods_sale_total + 1 > this.cartList[i].stock_num) {
if (this.cartList[i].count + 1 > this.cartList[i].stock_num) {
util.showNone("库存就这么多了!");
return;
}
this.cartList[i].erp_goods_sale_total += 1;
this.cartList[i].count += 1;
for (let i = 0; i < mainItems.length; ++i) {
mainItems[i].erp_goods_sale_total += 1;
mainItems[i].count += 1;
}
} break;
case "sub": {
if (this.cartList[i].erp_goods_sale_total > 0) {
this.cartList[i].erp_goods_sale_total -= 1;
if (this.cartList[i].count > 0) {
this.cartList[i].count -= 1;
}
for (let i = 0; i < mainItems.length; ++i) {
if (mainItems[i].erp_goods_sale_total > 0) {
mainItems[i].erp_goods_sale_total -= 1;
if (mainItems[i].count > 0) {
mainItems[i].count -= 1;
}
}
@ -290,7 +321,7 @@ export default {
}
//
if (this.cartList[i].erp_goods_sale_total <= 0) {
if (this.cartList[i].count <= 0) {
this.cartList.splice(i, 1);
}
@ -304,7 +335,7 @@ export default {
let arr = [];
for (let i = 0; i < this.cartList.length; ++i) {
if (this.cartList[i].erp_goods_sale_total) {
if (this.cartList[i].count) {
arr.push(tools.getNewObj(this.cartList[i]));
}
}
@ -340,7 +371,7 @@ export default {
//
for (let i = this.categoryIndex; i < this.goodsInfo.length; ++i) {
for (let j = 0; j < this.goodsInfo[i].goods_list.length; ++j) {
if (this.goodsInfo[i].goods_list[j].erp_goods_sale_total) {
if (this.goodsInfo[i].goods_list[j].count) {
this.cartList.push(tools.getNewObj(this.goodsInfo[i].goods_list[j]));
}
}
@ -441,7 +472,7 @@ export default {
}
//
if (!mark && searchAndHotData[i].erp_goods_sale_total) {
if (!mark && searchAndHotData[i].count) {
tempData.push(searchAndHotData[i]);
}
}
@ -457,8 +488,8 @@ export default {
//
for (let i = this.categoryIndex; i < this.goodsInfo.length; ++i) {
for (let j = 0; j < this.goodsInfo[i].goods_list.length; ++j) {
price += (this.goodsInfo[i].goods_list[j].erp_goods_sale_total * this.goodsInfo[i].goods_list[j].erp_goods_price);
count += this.goodsInfo[i].goods_list[j].erp_goods_sale_total;
price += (this.goodsInfo[i].goods_list[j].count * this.goodsInfo[i].goods_list[j].erp_goods_price);
count += this.goodsInfo[i].goods_list[j].count;
}
}
@ -466,8 +497,8 @@ export default {
let tempData = this.findDifferentData(); //
if (tempData.length) {
for (let i = 0; i < tempData.length; ++i) {
price += (tempData[i].erp_goods_sale_total * tempData[i].erp_goods_price);
count += tempData[i].erp_goods_sale_total;
price += (tempData[i].count * tempData[i].erp_goods_price);
count += tempData[i].count;
}
}
@ -501,18 +532,18 @@ export default {
switch (type) {
case "add": {
//
if (goodsItem.erp_goods_sale_total + 1 > goodsItem.stock_num) {
if (goodsItem.count + 1 > goodsItem.stock_num) {
util.showNone("库存就这么多了!");
return;
}
goodsItem.erp_goods_sale_total += 1;
goodsItem.count += 1;
} break;
case "sub": {
if (goodsItem.erp_goods_sale_total <= 0) {
if (goodsItem.count <= 0) {
return;
}
goodsItem.erp_goods_sale_total -= 1;
goodsItem.count -= 1;
} break;
}
}
@ -521,7 +552,7 @@ export default {
for (let i = 0; i < this.goodsInfo.length; ++i) {
for (let j = 0; j < this.goodsInfo[i].goods_list.length; ++j) {
if (this.goodsInfo[i].goods_list[j].id == goodsItem.id) {
this.goodsInfo[i].goods_list[j].erp_goods_sale_total = goodsItem.erp_goods_sale_total;
this.goodsInfo[i].goods_list[j].count = goodsItem.count;
}
}
}
@ -579,12 +610,18 @@ export default {
});
for (let i = 0; i < res.data.data.list.length; ++i) {
//
if (!res.data.data.list[i].goods_list || !res.data.data.list[i].goods_list.length) {
// res.data.data.list[i].goods_list = [];
continue;
}
if (res.data.data.list[i].cate.erp_goods_cate_name == "热销") {
_this.categoryIndex = 2; // 2
}
if (!res.data.data.list[i].goods_list) {
res.data.data.list[i].goods_list = [];
for (let j = 0; j < res.data.data.list[i].goods_list.length; ++j) {
res.data.data.list[i].goods_list[j].count = 0; //
}
res.data.data.list[i].isCateShow = true;
@ -596,8 +633,10 @@ export default {
_this.cartList = []; //
_this.totalCount = 0;
_this.totalPrice = 0;
_this.goodsInfo[1].style = _this.categoryBtnStyle.click;
_this.goodsInfo[1].isShow = true;
if (_this.goodsInfo.length > 1) {
_this.goodsInfo[1].style = _this.categoryBtnStyle.click;
_this.goodsInfo[1].isShow = true;
}
_this.categoryGoTop(); //
util.hideLoad();

2
src/subpackage/retail/pages/search/search.vue

@ -116,7 +116,7 @@
if (res.data.code == 0) {
let mark = false;
for (let i = 0; i < res.data.data.list.length; ++i) {
if (res.data.data.list[i].goods_list) {
if (res.data.data.list[i].goods_list && res.data.data.list[i].goods_list.length) {
mark = true;
}
}

Loading…
Cancel
Save