Commit cb444a1e by 李嘉林

快速加购

parent bd7da9ca
...@@ -11,7 +11,7 @@ export default { ...@@ -11,7 +11,7 @@ export default {
let extConfig = wx.getExtConfigSync ? wx.getExtConfigSync() : {}; let extConfig = wx.getExtConfigSync ? wx.getExtConfigSync() : {};
console.log(extConfig, "-----------extConfig"); console.log(extConfig, "-----------extConfig");
if (JSON.stringify(extConfig) == "{}") { if (JSON.stringify(extConfig) == "{}") {
extConfig = process.env.NODE_ENV == "development" ? { mixid: "antgood", shopid: 67}:{ "mixid":"fruit", "shopid": 1213 }; extConfig = process.env.NODE_ENV == "development" ? { mixid: "antgood", shopid: 67}:{ "mixid":"qiyeCT", "shopid": 1045 };
} }
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
</p> </p>
<van-stepper button-size="24px" integer :min="0" <van-stepper button-size="24px" integer :min="0"
:step="item.plusPurchaseMultiple" :step="item.plusPurchaseMultiple"
:max="item.oversoldFlag == 1 ? 999999 : item.maxLimitPurchaseNum > 0 ? item.maxLimitPurchaseNum : 999999" :max="item.maxLimitPurchaseNum > 0 ? item.maxLimitPurchaseNum : 999999"
@minus="(e) => changeQty(item, e, 'minus')" @plus="(e) => changeQty(item, e, 'plus')" @minus="(e) => changeQty(item, e, 'minus')" @plus="(e) => changeQty(item, e, 'plus')"
@blur="(e) => changeQty(item, e, 'blur')" v-model="item.qty" :disabled="item.disabled" /> @blur="(e) => changeQty(item, e, 'blur')" v-model="item.qty" :disabled="item.disabled" />
</div> </div>
...@@ -195,8 +195,12 @@ export default { ...@@ -195,8 +195,12 @@ export default {
) { ) {
qty = 0; qty = 0;
} else { } else {
if (qty - data.plusPurchaseMultiple < data.minLimitPurchaseNum && data.minLimitPurchaseNum > 0) {
qty = data.minLimitPurchaseNum;
} else {
qty -= (data.plusPurchaseMultiple - 0 || 1) qty -= (data.plusPurchaseMultiple - 0 || 1)
} }
}
} else if (type == "plus") { } else if (type == "plus") {
if (data.minLimitPurchaseNum > 0 && qty == 0) { if (data.minLimitPurchaseNum > 0 && qty == 0) {
qty = data.minLimitPurchaseNum<data.plusPurchaseMultiple?data.plusPurchaseMultiple:data.minLimitPurchaseNum; qty = data.minLimitPurchaseNum<data.plusPurchaseMultiple?data.plusPurchaseMultiple:data.minLimitPurchaseNum;
......
...@@ -132,7 +132,7 @@ export function $themeToLink(data, option) { ...@@ -132,7 +132,7 @@ export function $themeToLink(data, option) {
} }
} }
} }
export function $themeAddToCard(item, callback) { export function $themeAddToCard(item, callback = () => { }) {
let errorMsg = ""; let errorMsg = "";
if (item.productNature == 5) { if (item.productNature == 5) {
errorMsg = "电子卡券不可加入购物车"; errorMsg = "电子卡券不可加入购物车";
...@@ -151,7 +151,7 @@ export function $themeAddToCard(item, callback) { ...@@ -151,7 +151,7 @@ export function $themeAddToCard(item, callback) {
} }
cart cart
.addCart([ .addCart([
{ productGoodsId: item.minProductGoodsId, qty: item.saleQty } { productGoodsId: item.minProductGoodsId, qty: item.plusPurchaseMultiple }
]) ])
.then(res => { .then(res => {
if (res.data.code == 200) { if (res.data.code == 200) {
......
...@@ -117,13 +117,19 @@ const componentOptions = { ...@@ -117,13 +117,19 @@ const componentOptions = {
console.log("加入购物车"); console.log("加入购物车");
// $themeAddToCard(this.data.items); // $themeAddToCard(this.data.items);
console.log(app.globalData.shopInfo.whetherOpenEnterprisesWantGoods - 0,'app.globalData.shopInfo=') console.log(app.globalData.shopInfo.whetherOpenEnterprisesWantGoods - 0,'app.globalData.shopInfo=')
let { whetherToEnableQuickPurchase } = app.shop_configuration;
if (whetherToEnableQuickPurchase == 1) {
// 快速加购
$themeAddToCard(this.data.items);
} else {
// 选规格加购
if (app.globalData.shopInfo.whetherOpenEnterprisesWantGoods - 0 == 1) { if (app.globalData.shopInfo.whetherOpenEnterprisesWantGoods - 0 == 1) {
// 开启企业要货加购 // 开启企业要货加购
app.openTwoBAddCart(_this.data.items); app.openTwoBAddCart(_this.data.items);
} else { } else {
app.openSelectGoods(_this.data.items); app.openSelectGoods(_this.data.items);
} }
}
} else { } else {
// 进入确认订单 // 进入确认订单
linkVal = `/order/orderConfirm?productGoodsMixId=${minProductGoodsMixid}&productGoodsId=${minProductGoodsId}&goodsId=${minGoodsId}&qty=1&goodsString=null&source=3`; linkVal = `/order/orderConfirm?productGoodsMixId=${minProductGoodsMixid}&productGoodsId=${minProductGoodsId}&goodsId=${minGoodsId}&qty=1&goodsString=null&source=3`;
......
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