|
@@ -42,7 +42,6 @@ Page({
|
|
|
userrole: wx.getStorageSync('userrole'),
|
|
|
isShowFavorites: wx.getStorageSync('auth').wfavorites ? true : false
|
|
|
})
|
|
|
-
|
|
|
try {
|
|
|
let privacyFieldC = wx.getStorageSync('auth').wmarket.forms.wmarket.formcols.map(v => v.title);
|
|
|
this.setData({
|
|
@@ -80,6 +79,7 @@ Page({
|
|
|
}).format();
|
|
|
item.gradeprice = CNY(item.gradeprice);
|
|
|
item.marketprice = CNY(item.marketprice);
|
|
|
+ item.qty = item.orderaddqty;
|
|
|
this.setData({
|
|
|
content,
|
|
|
detail: item,
|
|
@@ -159,13 +159,6 @@ Page({
|
|
|
})
|
|
|
this.getDetail(valuename == "spec")
|
|
|
},
|
|
|
- clickBut() {
|
|
|
- this.data.detail.tradefield.length >= 2 ? wx.showToast({
|
|
|
- title: '请选择加入产品领域',
|
|
|
- icon: "none",
|
|
|
- duration: 3000
|
|
|
- }) : this.handleStorage(0);
|
|
|
- },
|
|
|
/* 打开文档 */
|
|
|
openDocument(e) {
|
|
|
const {
|
|
@@ -209,6 +202,10 @@ Page({
|
|
|
})
|
|
|
},
|
|
|
clickBut(e) {
|
|
|
+ if (this.data.itemCount != this.data.selectCount) return wx.showToast({
|
|
|
+ title: '请完成产品选项在进行操作',
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
this.data.detail.tradefield.length >= 2 ? wx.showToast({
|
|
|
title: '请选择加入产品领域',
|
|
|
icon: "none",
|
|
@@ -232,7 +229,7 @@ Page({
|
|
|
let content = Object.assign(this.data.content, {
|
|
|
sa_brandid,
|
|
|
itemid: detail.itemid, //货品id
|
|
|
- qty: detail.orderminqty, //数量
|
|
|
+ qty: detail.qty, //数量
|
|
|
itemno: detail.itemno, //货品编号
|
|
|
tradefield: detail.tradefield[index].tradefield,
|
|
|
}, custom);
|
|
@@ -270,7 +267,7 @@ Page({
|
|
|
"id": 20231121143403,
|
|
|
"content": {
|
|
|
"itemid": this.data.detail.itemid, //货品id
|
|
|
- "qty": detail.orderminqty, //数量
|
|
|
+ "qty": detail.qty, //数量
|
|
|
...custom,
|
|
|
iscollection,
|
|
|
...favorites
|
|
@@ -293,6 +290,48 @@ Page({
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ /* 立即下单 */
|
|
|
+ placeAnOrder(index) {
|
|
|
+ let detail = this.data.detail,
|
|
|
+ content = {
|
|
|
+ "type": "标准订单",
|
|
|
+ tradefield: detail.tradefield[index].tradefield
|
|
|
+ },
|
|
|
+ custom = {
|
|
|
+ length: 0,
|
|
|
+ width: 0
|
|
|
+ }
|
|
|
+ //是否为定制项
|
|
|
+ if (detail.iscustomsize == 1) custom = this.selectComponent("#customMade").getResult(true);
|
|
|
+ if (typeof custom == "boolean") return;
|
|
|
+ content.items = [Object.assign({
|
|
|
+ sa_orderitemsid: 0,
|
|
|
+ sa_brandid,
|
|
|
+ itemid: detail.itemid, //货品id
|
|
|
+ qty: detail.qty, //数量
|
|
|
+ itemno: detail.itemno, //货品编号
|
|
|
+ }, custom)];
|
|
|
+
|
|
|
+
|
|
|
+ _Http.basic({
|
|
|
+ "id": 20221128183202,
|
|
|
+ content,
|
|
|
+ }).then(res => {
|
|
|
+ console.log("创建订单", res)
|
|
|
+ wx.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: res.msg == '成功' ? '订单创建成功!是否立即查看' : res.msg,
|
|
|
+ complete: ({
|
|
|
+ confirm
|
|
|
+ }) => {
|
|
|
+ if (confirm) wx.navigateTo({
|
|
|
+ url: '/packageA/orderForm/detail?id=' + res.data.sa_orderid,
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+
|
|
|
+ },
|
|
|
/* 前往购物车 */
|
|
|
toCollect(e) {
|
|
|
getApp().globalData.changeBar({
|
|
@@ -307,4 +346,41 @@ Page({
|
|
|
})
|
|
|
this.getDetail(true, this.data.loading);
|
|
|
},
|
|
|
+ /* 步进器输入框失去焦点 */
|
|
|
+ inputBlur(e) {
|
|
|
+ let item = this.data.detail;
|
|
|
+ let qty = 0;
|
|
|
+ if (item.orderminqty > e.detail.value) {
|
|
|
+ wx.showToast({
|
|
|
+ title: '输入数量低于最低起订量!',
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ qty = item.orderminqty;
|
|
|
+ } else if (item.orderminqty < e.detail.value) {
|
|
|
+ var currencyRounding = value => currency(value, {
|
|
|
+ increment: item.orderaddqty
|
|
|
+ });
|
|
|
+ qty = currency(currencyRounding(currency(e.detail.value).subtract(item.orderminqty)).format()).add(item.orderminqty).value;
|
|
|
+
|
|
|
+ } else {
|
|
|
+ qty = e.detail.value;
|
|
|
+ }
|
|
|
+ this.setData({
|
|
|
+ "detail.qty": 0
|
|
|
+ });
|
|
|
+ this.setData({
|
|
|
+ "detail.qty": qty
|
|
|
+ });
|
|
|
+ },
|
|
|
+ stepperChange(e) {
|
|
|
+ let item = this.data.detail;
|
|
|
+ if (e.type == 'plus') {
|
|
|
+ item.qty += (item.orderaddqty) - 0 || 1
|
|
|
+ } else {
|
|
|
+ item.qty -= item.orderaddqty || 1
|
|
|
+ }
|
|
|
+ this.setData({
|
|
|
+ detail: item
|
|
|
+ })
|
|
|
+ },
|
|
|
})
|