|
@@ -190,40 +190,73 @@ Component({
|
|
|
/* 处理新增产品 */
|
|
|
handleSelect(detail) {
|
|
|
let that = this;
|
|
|
- wx.showModal({
|
|
|
- title: '提示',
|
|
|
- content: `是否确认添加${detail.result.length}件商品?`,
|
|
|
- complete: (res) => {
|
|
|
- if (res.confirm) _Http.basic({
|
|
|
- "id": 20221109093602,
|
|
|
- "content": {
|
|
|
- ...that.data.base,
|
|
|
- "items": detail.list.map(v => {
|
|
|
- return {
|
|
|
- sa_orderitemsid: 0,
|
|
|
- "itemid": v.itemid, //商品ID
|
|
|
- "qty": v.qty, //数量
|
|
|
- "width": v.width || 0,
|
|
|
- "length": v.length || 0,
|
|
|
- price: this.data.type == '工具订单' ? v.marketprice : v.contractprice,
|
|
|
- sa_promotion_itemsid: v.sa_promotion_itemsid || 0
|
|
|
- }
|
|
|
- })
|
|
|
+
|
|
|
+ _Http.basic({
|
|
|
+ "id": 2024020201095102,
|
|
|
+ "content": {
|
|
|
+ ...that.data.base,
|
|
|
+ "items": detail.list
|
|
|
+ },
|
|
|
+ }).then(res => {
|
|
|
+ console.log("查询重复产品", res)
|
|
|
+ if (res.msg != '成功') return wx.showToast({
|
|
|
+ title: res.msg,
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ if (res.data.items.length) {
|
|
|
+ wx.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: `本单已存在【${res.data.items[0].itemname}】商品,确认继续添加吗?`,
|
|
|
+ complete: (res) => {
|
|
|
+ if (res.cancel) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if (res.confirm) handle()
|
|
|
}
|
|
|
- }).then(s => {
|
|
|
- console.log('新增产品', s)
|
|
|
- wx.showToast({
|
|
|
- title: s.msg == '成功' ? '添加成功' : s.msg,
|
|
|
- icon: "none"
|
|
|
- });
|
|
|
- if (s.msg == '成功') setTimeout(() => {
|
|
|
- that.getList(sa_orderid, true);
|
|
|
- wx.navigateBack();
|
|
|
- that.updateThePrice();
|
|
|
- }, 300)
|
|
|
})
|
|
|
+ } else {
|
|
|
+ handle()
|
|
|
}
|
|
|
- });
|
|
|
+ })
|
|
|
+ function handle() {
|
|
|
+ wx.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: `是否确认添加${detail.result.length}件商品?`,
|
|
|
+ complete: (res) => {
|
|
|
+ if (res.confirm) _Http.basic({
|
|
|
+ "id": 20221109093602,
|
|
|
+ content: {
|
|
|
+ ...that.data.base,
|
|
|
+ "items": detail.list.map(v => {
|
|
|
+ return {
|
|
|
+ sa_orderitemsid: 0,
|
|
|
+ "itemid": v.itemid, //商品ID
|
|
|
+ "qty": v.qty, //数量
|
|
|
+ "width": v.width || 0,
|
|
|
+ "length": v.length || 0,
|
|
|
+ price: that.data.type == '工具订单' ? v.marketprice : v.contractprice,
|
|
|
+ sa_promotion_itemsid: v.sa_promotion_itemsid || 0
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }).then(s => {
|
|
|
+ console.log('新增产品', s)
|
|
|
+ wx.showToast({
|
|
|
+ title: s.msg == '成功' ? '添加成功' : s.msg,
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ if (s.msg == '成功') setTimeout(() => {
|
|
|
+ that.getList(sa_orderid, true);
|
|
|
+ wx.navigateBack();
|
|
|
+ that.updateThePrice();
|
|
|
+ }, 300)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
},
|
|
|
/* 使用接口更新总价 */
|
|
|
updateThePrice() {
|