xiaohaizhao 2 lat temu
rodzic
commit
f2478814cd
41 zmienionych plików z 1469 dodań i 387 usunięć
  1. 2 1
      app.json
  2. 25 22
      packageA/activity/selectProduct/cart/index.js
  3. 1 2
      packageA/activity/selectProduct/cart/index.wxml
  4. 39 29
      packageA/activity/selectProduct/index.js
  5. 1 1
      packageA/activity/selectProduct/index.scss
  6. 4 3
      packageA/activity/selectProduct/index.wxml
  7. 359 0
      packageA/favorites/index.js
  8. 9 0
      packageA/favorites/index.json
  9. 180 0
      packageA/favorites/index.scss
  10. 74 0
      packageA/favorites/index.wxml
  11. 84 99
      packageA/market/detail.js
  12. 1 1
      packageA/market/detail.json
  13. 32 0
      packageA/market/detail.scss
  14. 34 46
      packageA/market/detail.wxml
  15. 99 3
      packageA/orderForm/add/add.js
  16. 9 2
      packageA/orderForm/add/add.wxml
  17. 10 1
      packageA/orderForm/detail.js
  18. 11 4
      packageA/orderForm/detail.wxml
  19. 65 0
      packageA/orderForm/index.js
  20. 5 0
      packageA/orderForm/modules/product/index.js
  21. 2 1
      packageA/returnOne/index.js
  22. 1 1
      packageA/returnOne/index.wxml
  23. 29 26
      pages/index/collect/index.js
  24. 3 3
      pages/index/collect/index.wxml
  25. 25 68
      pages/index/collect/modules/custom.js
  26. 2 1
      pages/index/collect/modules/custom.json
  27. 11 39
      pages/index/collect/modules/custom.scss
  28. 2 15
      pages/index/collect/modules/custom.wxml
  29. 89 0
      pages/index/collect/modules/customMade/index.js
  30. 6 0
      pages/index/collect/modules/customMade/index.json
  31. 39 0
      pages/index/collect/modules/customMade/index.scss
  32. 19 0
      pages/index/collect/modules/customMade/index.wxml
  33. 44 4
      pages/index/index.js
  34. 1 1
      pages/index/market/index.wxml
  35. 7 0
      project.private.config.json
  36. 20 12
      select/product/index.js
  37. 1 1
      select/product/index.wxml
  38. 52 0
      static/work-icon.wxss
  39. 0 0
      static/work.wxss
  40. 4 1
      utils/Http.js
  41. 68 0
      utils/customItemType.js

+ 2 - 1
app.json

@@ -54,7 +54,8 @@
         "dispatchBill/rows",
         "dispatchBill/sentandback",
         "activity/selectProduct/cart/index",
-        "target/index"
+        "target/index",
+        "favorites/index"
       ]
     },
     {

+ 25 - 22
packageA/activity/selectProduct/cart/index.js

@@ -6,6 +6,11 @@ const _Http = getApp().globalData.http,
 	}).format();
 let downCount = {};
 let ids = {};
+
+import {
+	getCustomText
+} from "../../../../utils/customItemType";
+
 Page({
 	data: {
 		list: [],
@@ -22,29 +27,26 @@ Page({
 		this.setData({
 			hidePrice: wx.getStorageSync('hidePrice'),
 		})
-		getApp().globalData.customizedProduct = this.customizedProduct.bind(this);
-	},
-	//修改定制
-	customizedProduct(item) {
-		return new Promise((resolve) => {
-			_Http.basic({
-				"id": 20220924104302,
-				"content": {
-					"sa_shoppingcartid": item.sa_shoppingcartid,
-					"qty": item.qty,
-					"width": item.width || 0,
-					"length": item.length || 0
-				},
-			}).then(res => {
-				console.log("修改定制", res)
-				wx.showToast({
-					title: res.msg != '成功' ? res.msg : '修改成功',
-					icon: "none"
-				});
-				this.getList()
-				resolve(true)
+		getApp().globalData.customizedProduct = (item, custom) => {
+			return new Promise((resolve) => {
+				_Http.basic({
+					"id": 20220924104302,
+					"content": {
+						"sa_shoppingcartid": item.sa_shoppingcartid,
+						"qty": item.qty,
+						...custom
+					},
+				}).then(res => {
+					console.log("修改定制", res)
+					wx.showToast({
+						title: res.msg != '成功' ? res.msg : '修改成功',
+						icon: "none"
+					});
+					this.getList()
+					resolve(true)
+				})
 			})
-		})
+		}
 	},
 	/* 获取列表 */
 	getList() {
@@ -82,6 +84,7 @@ Page({
 						results: [v.sa_shoppingcartid],
 					})
 				}
+				if (v.iscustomsize) v.customText = getCustomText(v);
 				return v
 			});
 			this.setData({

+ 1 - 2
packageA/activity/selectProduct/cart/index.wxml

@@ -21,8 +21,7 @@
 					<view class="exp">品牌:{{item.brandname ||" --"}}</view>
 					<view class="exp">领域:{{item.tradefield_shoppingcart ||" --"}}</view>
 					<view class="exp" wx:if="{{item.iscustomsize}}" data-item="{{item}}" catch:tap="customization" style="color:#085CDF;">
-						长:{{item.length}} / 宽:{{item.width}}
-						<van-icon name="arrow-down" />
+						{{item.customText}}<van-icon name="arrow-down" />
 					</view>
 					<view class="price" style="bottom: {{item.iscustomsize?'40rpx':'0rpx'}};">{{handleHide.query(item.showPrice,hidePrice)}}/{{item.unitname}}</view>
 				</view>

+ 39 - 29
packageA/activity/selectProduct/index.js

@@ -3,7 +3,11 @@ const _Http = getApp().globalData.http,
   file = require("../../../utils/FormatTheAttachment"),
   {
     getItem
-  } = require("./calculatePrice")
+  } = require("./calculatePrice");
+import {
+  getCustomText
+} from "../../../utils/customItemType";
+
 Page({
   data: {
     loading: true,
@@ -32,7 +36,34 @@ Page({
       idname: options.idname || this.data.idname
     });
     this.getList()
-    getApp().globalData.customizedProduct = this.customizedProduct.bind(this);
+    getApp().globalData.customizedProduct = (item, custom) => {
+      item = getItem(getItem(Object.assign(item, custom)), 'newOldPrice', 'oldprice');
+      item.customText = getCustomText(item);
+
+      return new Promise((resolve) => {
+        let index = this.data.list.findIndex(v => v[this.data.idname] == item[this.data.idname]),
+          resultList = this.data.resultList,
+          result = this.data.result;
+        if (index != -1) this.data.list[index] = item;
+        let i = resultList.findIndex(v => v[this.data.idname] == item[this.data.idname]);
+        if (item.pitchOn) {
+          if (i == -1) {
+            resultList.push(item);
+            result.push(item[this.data.idname])
+          } else {
+            resultList[i] = item;
+          }
+        } else {
+          resultList[i] = item;
+        }
+        this.setData({
+          list: this.data.list,
+          result,
+          resultList
+        })
+        resolve(true)
+      })
+    }
   },
   onShow() {
     this.getCollectCount()
@@ -106,33 +137,6 @@ Page({
     item.pitchOn = false;
     if (item) this.selectComponent("#Custom").onClick(item)
   },
-  customizedProduct(item) {
-    item = getItem(item);
-    item = getItem(item, 'newOldPrice', 'oldprice');
-    return new Promise((resolve) => {
-      let index = this.data.list.findIndex(v => v[this.data.idname] == item[this.data.idname]),
-        resultList = this.data.resultList,
-        result = this.data.result;
-      if (index != -1) this.data.list[index] = item;
-      let i = resultList.findIndex(v => v[this.data.idname] == item[this.data.idname]);
-      if (item.pitchOn) {
-        if (i == -1) {
-          resultList.push(item);
-          result.push(item[this.data.idname])
-        } else {
-          resultList[i] = item;
-        }
-      } else {
-        resultList[i] = item;
-      }
-      this.setData({
-        list: this.data.list,
-        result,
-        resultList
-      })
-      resolve(true)
-    })
-  },
   getList(init = false) {
     //init 用于初始化分页
     if (init.detail != undefined) init = init.detail;
@@ -171,6 +175,12 @@ Page({
         if (!value.saledqty) value.saledqty = 0;
         value.maxQty = value.groupqty == 0 ? "" : value.groupqty - value.saledqty; //有限购 设置最高可订购数量
         value.qty = value.orderminqty;
+
+        if (value.iscustomsize) {
+          value.customText = getCustomText(value);
+          value.pitchOn = false;
+        }
+
         return value;
       })
       this.setData({

+ 1 - 1
packageA/activity/selectProduct/index.scss

@@ -107,7 +107,7 @@ page {
 	min-height: 130rpx;
 	position: fixed;
 	bottom: 0;
-	z-index: 999;
+	z-index: 9 !important;
 	display: flex;
 	justify-content: space-between;
 	padding: 0 30rpx;

+ 4 - 3
packageA/activity/selectProduct/index.wxml

@@ -18,9 +18,8 @@
 				<view class="exp">规格:{{item.standards ||" --"}}</view>
 				<view class="exp">型号:{{item.model ||" --"}}</view>
 				<view class="exp"><text style="font-size: 24rpx;font-weight: 600;color: #FF3B30;">{{item.showPrice||item.newPrice}}</text><text style="font-size: 20rpx; text-decoration:line-through; margin-left: 6rpx;">{{item.newOldPrice||item.oldPrice}}</text></view>
-
-				<view wx:if="{{item.iscustomsize}}" class="subfield line-1" data-item="{{item}}" catch:tap="customization" style="color:#085CDF;">
-					长:{{item.length||0}} / 宽:{{item.width||0}}
+				<view wx:if="{{item.iscustomsize}}" class="exp" data-item="{{item}}" catch:tap="customization" style="color:#085CDF;">
+					{{item.customText}}
 					<van-icon name="arrow-down" />
 				</view>
 				<view class="exp">特征码:{{item.signaturecode ||" --"}}</view>
@@ -43,6 +42,8 @@
 	<Yl_Empty wx:if="{{list.length==0}}" />
 </Yl_ListBox>
 <footer wx:if="{{butText=='生成订单'}}" id='Footer' disabled='{{!result.length}}' bind:onClick='updateCart' />
+
+
 <!-- 底部 -->
 <block wx:else>
 	<view style="height: 130rpx;" />

+ 359 - 0
packageA/favorites/index.js

@@ -0,0 +1,359 @@
+const _Http = getApp().globalData.http,
+  currency = require("../../utils/currency"),
+  CNY = sum => currency(sum, {
+    symbol: "¥",
+    precision: 2
+  }).format();
+let downCount = {};
+import {
+  getCustomText
+} from "../../utils/customItemType";
+Page({
+  data: {
+    list: [],
+    results: [], //选中结果
+    classList: [], //生成订单时所选
+    sum: 0, //价格合
+    hidePrice: wx.getStorageSync('hidePrice')
+  },
+  onLoad() {
+    this.getList()
+  },
+  /* 打开设置定制项 */
+  customization(e) {
+    const {
+      item
+    } = e.target.dataset;
+    if (item) this.selectComponent("#Custom").onClick(item)
+  },
+  onShow() {
+    //修改定制项产品
+    getApp().globalData.customizedProduct = (item, custom) => {
+      let obj = {
+        "width": 0,
+        "length": 0,
+      }
+      for (const key in custom) {
+        let name = key.replace("favorites", '')
+        obj[name] = custom[key]
+      }
+      return new Promise((resolve) => {
+        _Http.basic({
+          "id": 20231121143403,
+          "content": {
+            "itemid": item.itemid,
+            "sa_favoritesid": item.sa_favoritesid,
+            "favoritesqty": item.favoritesqty,
+            "qty": item.favoritesqty,
+            ...obj,
+            ...custom,
+            "iscollection": true
+          },
+        }).then(res => {
+          console.log("修改定制", res)
+          wx.showToast({
+            title: res.msg != '成功' ? res.msg : '修改成功',
+            icon: "none"
+          });
+          this.getList()
+          resolve(true)
+        })
+      })
+    }
+  },
+  /* 获取列表 */
+  getList() {
+    _Http.basic({
+      "id": 20231121145103,
+      "content": {
+        nocache: true,
+        istool: 0,
+        "pageNumber": 1,
+        "pageSize": getApp().globalData.favoriteCount + 5,
+        "where": {
+          "condition": ""
+        }
+      }
+    }).then(res => {
+      console.log('收藏夹列表', res)
+      this.selectComponent('#ListBox').RefreshToComplete();
+      this.selectComponent("#ListBox").setHeight(".head", this);
+      if (res.msg != '成功') return wx.showToast({
+        title: res.msg,
+        icon: "none"
+      })
+      this.setData({
+        list: res.data.map(v => {
+          v.showPrice = CNY(v.gradeprice)
+          if (v.iscustomsize) v.customText = getCustomText(v, 'favorites');
+          return v
+        })
+      });
+      if (wx.getStorageSync('favorites')) {
+        this.setData({
+          ...wx.getStorageSync('favorites')
+        });
+        this.computeSum();
+      }
+    })
+  },
+  /* 选中单品 */
+  clickBut(e) {
+    this.data.classList.length >= 2 ? wx.showToast({
+      title: '请选择订单领域(订单只允许同领域的商品)',
+      icon: "none",
+      duration: 3000
+    }) : this[e.target.id](0);
+  },
+  /* 是否选择全部 */
+  setIsAll() {
+    let isAll = this.data.isAll;
+    this.setData({
+      results: isAll ? [] : this.data.list.map(v => v.sa_favoritesid),
+      isAll: !isAll
+    })
+    this.computeSum();
+  },
+  /* 计算总价/产品领域分类 */
+  computeSum() {
+    let results = this.data.results,
+      sum = 0,
+      classList = [];
+    if (results.length) results = results.filter(v => {
+      let item = this.data.list.find(va => va.sa_favoritesid == v);
+      if (item) {
+        sum = currency(sum).add(currency(item.favoritesqty).multiply(item.gradeprice)).value;
+        /* 领域分类 */
+        let index = classList.findIndex(value => value.type == item.tradefield[0].tradefield);
+        if (index == -1) {
+          classList.push({
+            type: item.tradefield[0].tradefield,
+            list: [item],
+            name: item.tradefield[0].tradefield + "(1件商品)"
+          })
+        } else {
+          classList[index].list.push(item)
+          classList[index].name = classList[index].type + `(${classList[index].list.length}件商品)`
+        }
+      };
+      return item
+    });
+    wx.setStorageSync('shopping', {
+      results
+    })
+    console.log("计算价格results", results)
+    this.setData({
+      sum: CNY(sum),
+      isAll: results.length == this.data.list.length,
+      results,
+      classList
+    });
+  },
+  /* 提交 */
+  submit(e) {
+    this[e.target.id](e.detail.value)
+  },
+  /* 处理生成订单 */
+  handleSubmit(index) {
+    let data = this.data.classList[index];
+    wx.showLoading({
+      title: '生成中...',
+    })
+    _Http.basic({
+      "id": 20221128183202,
+      "content": {
+        istool: 0,
+        type: "标准订单",
+        "tradefield": data.type, //必选
+        sa_brandid: this.data.sa_brandid,
+        "items": data.list.map(v => {
+          return {
+            "sa_orderitemsid": 0,
+            "itemid": v.itemid,
+            "qty": v.favoritesqty,
+            "sa_brandid": v.brand.length ? v.brand[0].sa_brandid : this.data.sa_brandid || 0,
+            width: v.favoriteswidth || 0,
+            length: v.favoriteslength || 0,
+          }
+        })
+      }
+    }).then(res => {
+      wx.hideLoading()
+      console.log("转化订单", res)
+      if (res.msg != '成功') return wx.showToast({
+        title: res.msg,
+        icon: "none"
+      });
+      this.setData({
+        results: [],
+        isAll: false
+      })
+      wx.showModal({
+        title: '提示',
+        content: '生成成功!是否立即前往',
+        complete: (s) => {
+          if (s.confirm) wx.navigateTo({
+            url: '/packageA/orderForm/detail?id=' + res.data.sa_orderid,
+          })
+        }
+      });
+    })
+  },
+  addToShoppingCart(index) {
+    let data = this.data.classList[index];
+    wx.showLoading({
+      title: '处理中...',
+    })
+    _Http.basic({
+      "id": 20231024110003,
+      "content": {
+        "items": data.list.map(v => {
+          return {
+            "sa_brandid": v.brand.length ? v.brand[0].sa_brandid : 0,
+            "itemid": v.itemid,
+            "qty": v.favoritesqty,
+            "itemno": v.itemno,
+            "tradefield": data.type,
+            "length": v.favoriteslength || 0,
+            "width": v.favoriteswidth || 0
+          }
+        })
+      }
+    }).then(res => {
+      wx.hideLoading()
+      console.log("加入购物车", res)
+      wx.showToast({
+        title: res.msg != '成功' ? res.msg : "加入成功",
+        icon: "none"
+      });
+      if (res.msg != '成功') return;
+      this.setData({
+        results: [],
+        isAll: false
+      })
+    })
+  },
+  /* 切换选中项 */
+  changeResults(e, my = false) {
+    const {
+      item
+    } = my ? e : e.currentTarget.dataset;
+    let results = this.data.results,
+      sa_brandid = this.data.sa_brandid;
+    console.log(item)
+    if (sa_brandid && sa_brandid != item.sa_brandid) return;
+    if (results.length == 0) {
+      results.push(item.sa_favoritesid);
+      sa_brandid = item.sa_brandid;
+    } else {
+      let index = results.findIndex(v => v == item.sa_favoritesid)
+      if (index == -1) {
+        results.push(item.sa_favoritesid);
+      } else {
+        results.splice(index, 1);
+        if (results.length == 0) sa_brandid = null;
+      }
+    };
+    this.setData({
+      results,
+      sa_brandid
+    })
+    this.computeSum();
+  },
+  /* 删除产品 */
+  deteleItem(e) {
+    const {
+      item
+    } = e.currentTarget.dataset;
+    wx.showModal({
+      title: '提示',
+      content: `是否确认删除${item.itemname}?`,
+      complete: ({
+        confirm
+      }) => {
+        e.detail.instance.close();
+        if (confirm) _Http.basic({
+          "id": 20231121143403,
+          "content": {
+            "itemid": item.itemid,
+            "iscollection": false
+          }
+        }).then(res => {
+          wx.showToast({
+            title: res.msg != '成功' ? res.msg : "删除成功",
+            icon: "none"
+          });
+          if (res.msg != '成功') return;
+          this.getList(true)
+          getApp().globalData.getFavoriteCount()
+        })
+      }
+    })
+  },
+  /* 输入框失去焦点调整数量 */
+  inputBlur(e) {
+    const {
+      index
+    } = e.currentTarget.dataset;
+    let item = this.data.list[index];
+    let favoritesqty = 0;
+    if (item.orderminqty > e.detail.value) {
+      wx.showToast({
+        title: '输入数量低于最低起订量!',
+        icon: "none"
+      })
+      favoritesqty = item.orderminqty;
+    } else if (item.orderminqty < e.detail.value) {
+      var currencyRounding = value => currency(value, {
+        increment: item.orderaddqty
+      });
+      favoritesqty = currency(currencyRounding(currency(e.detail.value).subtract(item.orderminqty)).format()).add(item.orderminqty).value;
+
+    } else {
+      favoritesqty = e.detail.value;
+    }
+    this.setData({
+      [`list[${index}].favoritesqty`]: 0
+    });
+    this.setData({
+      [`list[${index}].favoritesqty`]: favoritesqty
+    });
+    this.handleChangeQty(item, index)
+  },
+  /* 步进器调整数量 */
+  stepperChange(e) {
+    const {
+      index
+    } = e.currentTarget.dataset;
+    let item = this.data.list[index];
+    if (e.type == 'plus') {
+      item.favoritesqty += item.orderaddqty
+    } else {
+      item.favoritesqty -= item.orderaddqty
+    }
+    this.setData({
+      [`list[${index}]`]: item
+    })
+    this.handleChangeQty(item, index)
+  },
+  handleChangeQty(item, index) {
+    this.computeSum();
+    clearTimeout(downCount['count' + index])
+    downCount['count' + index] = setTimeout(() => {
+      _Http.basic({
+        "id": 20231121143403,
+        "content": {
+          "sa_favoritesid": item.sa_favoritesid,
+          "itemid": item.itemid,
+          "favoritesqty": item.favoritesqty,
+          "qty": item.favoritesqty,
+          "width": item.width || 0,
+          "length": item.length || 0,
+          "iscollection": true
+        },
+      }, false).then(res => {
+        console.log("修改数量", res)
+      })
+    }, 1000)
+  }
+})

+ 9 - 0
packageA/favorites/index.json

@@ -0,0 +1,9 @@
+{
+  "component": true,
+  "usingComponents": {
+    "van-checkbox": "@vant/weapp/checkbox/index",
+    "van-stepper": "@vant/weapp/stepper/index",
+    "van-swipe-cell": "@vant/weapp/swipe-cell/index",
+    "custom": "../../pages/index/collect/modules/custom"
+  }
+}

+ 180 - 0
packageA/favorites/index.scss

@@ -0,0 +1,180 @@
+.item-box {
+	position: relative;
+	width: 100vw;
+	background-color: #fff;
+	margin-bottom: 20rpx;
+	padding-bottom: 16rpx;
+	box-sizing: border-box;
+
+	.top {
+		display: flex;
+		padding: 20rpx 30rpx 0rpx;
+		box-sizing: border-box;
+
+
+		.image {
+			width: 128rpx;
+			height: 128rpx;
+			border-radius: 16rpx;
+			overflow: hidden;
+			margin-right: 20rpx;
+			flex-shrink: 0;
+		}
+
+		.content {
+			position: relative;
+			flex: 1;
+
+			.title {
+				display: flex;
+				align-items: center;
+				justify-content: space-between;
+				height: 40rpx;
+
+				.line-1 {
+					display: block;
+					width: 500rpx;
+					font-size: 28rpx;
+					font-family: PingFang SC-Semibold, PingFang SC;
+					font-weight: 600;
+					color: #333333;
+				}
+
+				.iconfont {
+					position: absolute;
+					width: 60rpx;
+					height: 60rpx;
+					line-height: 60rpx;
+					right: 0;
+					flex-shrink: 0;
+				}
+			}
+
+			.exp {
+				line-height: 34rpx;
+				font-size: 24rpx;
+				font-family: PingFang SC-Regular, PingFang SC;
+				color: #999999;
+				margin-top: 8rpx;
+			}
+
+			.price {
+				position: absolute;
+				font-size: 28rpx;
+				font-weight: 600;
+				color: #FF3B30;
+				right: 10rpx;
+			}
+		}
+
+	}
+
+	.bottom {
+		display: flex;
+		justify-content: space-between;
+		align-items: center;
+		height: 58rpx;
+		padding: 0 30rpx;
+		box-sizing: border-box;
+		margin-top: 12rpx;
+
+		.check {
+			display: flex;
+			align-items: center;
+			height: 100%;
+			width: 380rpx;
+			font-size: 24rpx;
+			font-family: PingFang SC-Regular, PingFang SC;
+			color: #999999;
+		}
+
+		.input-class {
+			width: 120rpx;
+		}
+	}
+}
+
+.cell-right {
+	background-color: #E54D42;
+	display: flex;
+	align-items: center;
+	justify-content: center;
+	color: #fff;
+	font-weight: 700;
+	font-size: 28rpx;
+	width: 65px;
+	height: 100%;
+}
+
+.footer-box {
+	position: fixed;
+	bottom: 0;
+	padding: 0;
+	z-index: 99;
+
+	.footer {
+		width: 100vw;
+		min-height: 130rpx;
+		z-index: 999;
+		display: flex;
+		justify-content: space-between;
+		padding: 0 30rpx;
+		box-sizing: border-box;
+		background-color: #fff;
+		box-shadow: rgba(0, 0, 0, 0.15) 0px 5rpx 15rpx 0px;
+
+
+		.left {
+			flex: 1;
+			color: #333333;
+
+			.selected {
+				font-size: 24rpx;
+				color: #999;
+			}
+
+			.sum {
+				height: 40rpx;
+				line-height: 40rpx;
+				font-size: 28rpx;
+				font-family: PingFang SC-Medium, PingFang SC;
+				font-weight: 500;
+				margin-top: 10rpx;
+
+				text {
+					color: #FF3B30;
+				}
+			}
+
+			.transport {
+				height: 34rpx;
+				line-height: 34rpx;
+				font-size: 24rpx;
+				font-family: PingFang SC-Regular, PingFang SC;
+				margin-top: 8rpx;
+
+				text {
+					color: #FF3B30;
+				}
+			}
+		}
+
+		.but {
+			width: 200rpx;
+			height: 90rpx;
+			background: #3874F6;
+			border-radius: 0 16rpx 16rpx 0;
+			font-size: 28rpx;
+			font-weight: 600;
+			color: #FFFFFF;
+			margin-top: 10rpx;
+
+		}
+
+		.shopping {
+			background: #FA8C16 !important;
+			border-radius: 16rpx 0 0 16rpx;
+		}
+	}
+
+}

+ 74 - 0
packageA/favorites/index.wxml

@@ -0,0 +1,74 @@
+<view class="head" />
+<custom id="Custom" prefix='favorites' />
+<Yl_ListBox id='ListBox' bind:getlist='getList'>
+	<van-swipe-cell wx:for="{{list}}" wx:key="itemid" id="swipe-cell" right-width="{{ 65 }}" async-close data-item="{{item}}" bind:close="deteleItem">
+		<view url="#" class="item-box">
+			<view class="top" catch:tap="changeResults" data-item="{{item}}">
+				<view class="image">
+					<van-image width="100%" height="100%" fit="cover" src="{{item.attinfos[0].subfiles[0].url||item.attinfos[0].url||item.cover}}" use-loading-slot use-error-slot lazy-load>
+						<van-loading slot="loading" type="spinner" size="20" vertical />
+						<text slot="error">加载失败</text>
+					</van-image>
+				</view>
+				<view class="content">
+					<view class="title">
+						<text class="line-1">{{item.itemname}}</text>
+						<van-checkbox shape='square' icon-size='24rpx' value="{{ decide.checked(item.sa_favoritesid,results) }}" />
+					</view>
+					<view class="exp">编号:{{item.itemno}}</view>
+					<view class="exp">型号:{{item.model ||" --"}}</view>
+					<view class="exp">品牌:{{item.brandname ||" --"}}</view>
+					<view class="exp">领域:{{item.tradefield_shoppingcart ||" --"}}</view>
+					<view class="exp" wx:if="{{item.iscustomsize}}" data-item="{{item}}" catch:tap="customization" style="color:#085CDF;">
+						{{item.customText}}
+						<van-icon name="arrow-down" />
+					</view>
+					<view class="price" style="bottom: {{item.iscustomsize?'40rpx':'0rpx'}};">{{handleHide.query(item.showPrice,hidePrice)}}/{{item.unitname}}</view>
+				</view>
+			</view>
+			<view class="bottom">
+				<view class="check label-class">
+					起订量:{{item.orderminqty}},增减量:{{item.orderaddqty}}
+				</view>
+				<van-stepper value="{{ item.favoritesqty }}" min="{{item.orderminqty}}" step="{{item.orderaddqty||1}}" input-class='input-class' data-index="{{index}}" bind:minus='stepperChange' bind:plus='stepperChange' bind:blur='inputBlur' />
+			</view>
+		</view>
+		<view slot="right" class="cell-right">移 除</view>
+	</van-swipe-cell>
+	<Yl_Empty wx:if="{{list.length === 0}}" />
+	<view style="height: 120rpx;" />
+</Yl_ListBox>
+<view class="footer-box">
+	<view class="footer">
+		<view class="left">
+			<view style="margin-top: 8rpx;">
+				<van-checkbox icon-size="26rpx" shape='square' value="{{ isAll }}" bind:change="setIsAll">全选 <text class="selected">已选{{results.length}}件</text></van-checkbox>
+			</view>
+			<view class="sum">
+				合计:<text>{{handleHide.query(sum,hidePrice)}}</text>
+			</view>
+			<view class="transport">
+				{{logistics}}
+			</view>
+		</view>
+		<picker wx:if="{{classList.length>=2}}" id='addToShoppingCart' range='{{classList}}' range-key='name' disabled='{{!results.length}}' bindchange="submit">
+			<van-button custom-class='but shopping' id='addToShoppingCart' disabled='{{!results.length}}' bind:click="clickBut">加入购物车</van-button>
+		</picker>
+		<van-button wx:else custom-class='but shopping' id='addToShoppingCart' disabled='{{!results.length}}' bind:click="clickBut">加入购物车</van-button>
+
+		<picker wx:if="{{classList.length>=2}}" id='handleSubmit' range='{{classList}}' range-key='name' disabled='{{!results.length}}' bindchange="submit">
+			<van-button custom-class='but' disabled='{{!results.length}}' id='handleSubmit' bind:click="clickBut">生成订单</van-button>
+		</picker>
+		<van-button wx:else custom-class='but' id='handleSubmit' disabled='{{!results.length}}' bind:click="clickBut">生成订单</van-button>
+	</view>
+</view>
+<wxs module="decide">
+	module.exports = {
+		checked: function (id, list) {
+			return list.some(function (v) {
+				return v == id
+			});
+		}
+	}
+</wxs>
+<wxs src="/utils/hidePrice.wxs" module="handleHide" />

+ 84 - 99
packageA/market/detail.js

@@ -1,6 +1,11 @@
 const _Http = getApp().globalData.http;
 let sa_brandid = null,
 	sys_enterpriseid = null;
+
+import {
+	getLabelList
+} from "../../utils/customItemType";
+
 import {
 	fileList
 } from "../../utils/FormatTheAttachment";
@@ -8,23 +13,23 @@ import currency from "../../utils/currency";
 
 Page({
 	data: {
+		itemCount: 0,
+		selectCount: 0,
+		labelList: getLabelList(),
 		hidePrice: wx.getStorageSync('hidePrice'),
 		badge: getApp().globalData.collectCount,
+		favoriteCount: getApp().globalData.favoriteCount,
 		loading: true,
 		content: {
 			sa_itemgroupid: null,
 			spec: "", //规格
 			color: "", //颜色
 			material: "", //材质
-			cheek: "", //边框
-			dwidth: 0,
-			dlength: 0,
+			cheek: "" //边框
 		},
 		detail: {
 			spec: ""
 		},
-		cWidth: null, //宽定制方案
-		cLength: null, //长定制方案
 	},
 	onLoad(options) {
 		let data = JSON.parse(options.params);
@@ -70,50 +75,11 @@ Page({
 				cheekRows: res.data.cheekRows,
 				materialRows: res.data.materialRows,
 				colorRows: res.data.colorRows,
-				loading: false
+				loading: false,
+				itemCount: ['specRows', 'cheekRows', 'materialRows', 'colorRows'].filter(v => res.data[v].length).length
 			});
 			//是否定制
-			if (init) {
-				if (item.iscustomsize == 1) {
-					let cWidth = null,
-						cLength = null;
-					Promise.all([{
-						"id": "20230707091603",
-						"version": 1,
-						"content": {
-							"sa_sizecustomizedschemeid": item.lengthschemeid,
-							date: Date.now() + 1
-						}
-					}, {
-						"id": "20230707091603",
-						"version": 1,
-						"content": {
-							"sa_sizecustomizedschemeid": item.widthschemeid,
-							date: Date.now() + 2
-						}
-					}].map(v => _Http.basic(v))).then(s => {
-						if (s.some(c => c.msg != '成功')) return wx.showToast({
-							title: '定制方案获取失败',
-							icon: "none"
-						})
-						if (item.lengthschemeid) cLength = s[0].data;
-						if (item.widthschemeid) cWidth = s[1].data;
-						this.setData({
-							cWidth,
-							cLength,
-							"content.dwidth": cWidth.min || 0,
-							"content.dlength": cLength.min || 0,
-						});
-					})
-				} else {
-					this.setData({
-						cWidth: null,
-						cLength: null,
-						"content.dwidth": 0,
-						"content.dlength": 0,
-					});
-				}
-			}
+			if (item.iscustomsize == 1) this.selectComponent("#customMade").init(item);
 		})
 	},
 	/* 预览媒体 */
@@ -176,39 +142,12 @@ Page({
 			mask: true
 		})
 		content[valuename] = (content[valuename] == value.parm) ? "" : value.parm;
-		this.getDetail(valuename == "spec")
-	},
-	/* 定制选项 */
-	customParameter(e) {
-		let {
-			value,
-			valuename
-		} = e.currentTarget.dataset;
-		this.data.content[valuename] = value;
 		this.setData({
-			content: this.data.content
-		})
-	},
-	/* 定制步进器 */
-	cahngeStepper(e) {
-		const name = e.currentTarget.dataset.name,
-			name2 = name == 'cWidth' ? "dwidth" : "dlength",
-			content = this.data.content;
-		if (e.type == 'plus') {
-			content[name2] += 1
-		} else if (e.type == 'minus') {
-			content[name2] -= 1
-		} else {
-			const data = this.data[name];
-			content[name2] = (e.detail.value - 0).toFixed(data.decimalplaces);
-		}
-		let item = this.data[name];
-		if (content[name2] > item.max) content[name2] = item.max;
-		if (content[name2] < item.min) content[name2] = item.min;
-		this.setData({
-			content
+			selectCount: ['cheek', 'color', 'material', 'spec'].filter(v => content[v].length).length
 		})
+		this.getDetail(valuename == "spec")
 	},
+
 	clickBut() {
 		this.data.detail.tradefield.length >= 2 ? wx.showToast({
 			title: '请选择加入产品领域',
@@ -258,34 +197,38 @@ Page({
 			}
 		})
 	},
+	clickBut(e) {
+		this.data.detail.tradefield.length >= 2 ? wx.showToast({
+			title: '请选择加入产品领域',
+			icon: "none",
+			duration: 3000
+		}) : this[e.target.id](0);
+	},
 	/* 选择领域 */
 	storage(e) {
-		this.handleStorage(e.detail.value)
+		this.addToShoppingCart(e.detail.value)
 	},
-	handleStorage(index) {
+	/* 加入购物车 */
+	addToShoppingCart(index) {
 		let detail = this.data.detail,
-			content = this.data.content;
-		if (detail.iscustomsize == 1) {
-			if (detail.widthschemeid != 0 && content.dwidth == 0) return wx.showToast({
-				title: '请完成定制宽选项',
-				icon: "none"
-			})
-			if (detail.lengthschemeid != 0 && content.dlength == 0) return wx.showToast({
-				title: '请完成定制长选项',
-				icon: "none"
-			})
-		}
+			custom = {
+				length: 0,
+				width: 0
+			};
+		//是否为定制项
+		if (detail.iscustomsize == 1) custom = this.selectComponent("#customMade").getResult(true);
+		if (typeof custom == "boolean") return;
+		let content = Object.assign(this.data.content, {
+			sa_brandid,
+			itemid: detail.itemid, //货品id
+			qty: detail.orderminqty, //数量
+			itemno: detail.itemno, //货品编号
+			tradefield: detail.tradefield[index].tradefield,
+		}, custom);
+
 		_Http.basic({
 			"id": 20220924095102,
-			"content": {
-				sa_brandid,
-				"itemid": detail.itemid, //货品id
-				"qty": detail.orderminqty, //数量
-				itemno: detail.itemno, //货品编号
-				tradefield: detail.tradefield[index].tradefield,
-				width: content.dwidth,
-				length: content.dlength
-			},
+			content,
 		}).then(res => {
 			console.log("加入购物车", res)
 			wx.showToast({
@@ -297,6 +240,48 @@ Page({
 			}))
 		})
 	},
+	/* 加入收藏夹 */
+	addToFavorites() {
+		let detail = this.data.detail,
+			iscollection = detail.iscollection == 1 ? false : true,
+			custom = {
+				width: 0,
+				length: 0,
+			},
+			favorites = {};
+		//是否为定制项
+		if (detail.iscustomsize == 1) custom = this.selectComponent("#customMade").getResult(true);
+		for (const key in custom) {
+			favorites['favorites' + key] = custom[key]
+		}
+		if (typeof custom == "boolean") return;
+		_Http.basic({
+			"id": 20231121143403,
+			"content": {
+				"itemid": this.data.detail.itemid, //货品id
+				"qty": detail.orderminqty, //数量
+				...custom,
+				iscollection,
+				...favorites
+			},
+		}).then(res => {
+			console.log(iscollection + "收藏夹", res)
+			wx.showToast({
+				title: res.msg == '成功' ? iscollection ? '收藏成功' : "已取消收藏" : res.msg,
+				icon: "none"
+			});
+			if (res.msg == '成功') {
+				getApp().globalData.getFavoriteCount().then(num => {
+					this.setData({
+						favoriteCount: num
+					})
+				})
+				this.setData({
+					"detail.iscollection": iscollection ? 1 : 0
+				})
+			}
+		})
+	},
 	/* 前往购物车 */
 	toCollect(e) {
 		getApp().globalData.changeBar({

+ 1 - 1
packageA/market/detail.json

@@ -1,6 +1,6 @@
 {
   "usingComponents": {
     "van-tag": "@vant/weapp/tag/index",
-    "van-stepper": "@vant/weapp/stepper/index"
+    "customMade": "/pages/index/collect/modules/customMade/index"
   }
 }

+ 32 - 0
packageA/market/detail.scss

@@ -97,6 +97,7 @@ swiper {
   padding-left: 30rpx;
   box-sizing: border-box;
   margin-top: 20rpx;
+  padding-bottom: 20rpx;
 
   .label {
     padding: 20rpx 0;
@@ -123,6 +124,19 @@ swiper {
     padding: 0 !important;
   }
 
+
+  .activity {
+    width: 96%;
+    box-sizing: border-box;
+    text-align: center;
+    padding: 14rpx;
+    background-color: #F6E0E2;
+    color: #CB3B3B;
+    border-radius: 8rpx;
+    border: 1px #CB3B3B dashed;
+    margin-bottom: 20rpx;
+  }
+
   .product-box {
     display: flex;
     flex-wrap: wrap;
@@ -142,6 +156,8 @@ swiper {
     .active {
       background: #E7EEFF;
     }
+
+
   }
 
   .product-box:last-child {
@@ -213,4 +229,20 @@ swiper {
     color: #3874F6;
     margin-bottom: 20rpx;
   }
+}
+
+.submit {
+  height: 104rpx !important;
+  border: none !important;
+  border-radius: 0 !important;
+  color: #fff !important;
+  width: 240rpx !important;
+}
+
+.bg-blue {
+  background-color: var(--blue) !important;
+}
+
+.bg-orange {
+  background-color: #F37B1D !important;
 }

+ 34 - 46
packageA/market/detail.wxml

@@ -36,7 +36,7 @@
 <view class="model">
     <block wx:if="{{materialRows.length}}">
         <view class="label">
-            基材
+            {{labelList.material}}
         </view>
         <view class="product-box">
             <navigator url="#" class="product {{content.material===item.parm?'active':''}} {{item.flag?'':'disabled'}}" wx:for="{{materialRows}}" wx:key="index" bindtap="changeItemno" data-valuename="material" data-value="{{item}}">{{item.parm}}</navigator>
@@ -45,7 +45,7 @@
 
     <block wx:if="{{colorRows.length}}">
         <view class="label">
-            颜色
+            {{labelList.color}}
         </view>
         <view class="product-box">
             <navigator url="#" class="product {{content.color===item.parm?'active':''}} {{item.flag?'':'disabled'}}" wx:for="{{colorRows}}" wx:key="index" bindtap="changeItemno" data-valuename="color" data-value="{{item}}">{{item.parm}}</navigator>
@@ -54,7 +54,7 @@
 
     <block wx:if="{{cheekRows.length}}">
         <view class="label">
-            边框
+            {{labelList.cheek}}
         </view>
         <view class="product-box">
             <navigator url="#" class="product {{content.cheek===item.parm?'active':''}}  {{item.flag?'':'disabled'}}" wx:for="{{cheekRows}}" wx:key="index" bindtap="changeItemno" data-valuename="cheek" data-value="{{item}}">{{item.parm}}</navigator>
@@ -63,55 +63,36 @@
 
     <block wx:if="{{specRows.length}}">
         <view class="label">
-            尺寸
+            {{labelList.spec}}
         </view>
         <view class="product-box">
             <navigator url="#" class="product {{content.spec===item.parm?'active':''}} {{item.flag?'':'disabled'}}" wx:for="{{specRows}}" wx:key="index" bindtap="changeItemno" data-valuename="spec" data-value="{{item}}">{{item.parm=='custom'?'自定义':item.parm}}</navigator>
         </view>
     </block>
-
-
-
     <!-- 定制项 -->
     <view wx:if="{{detail.iscustomsize==1}}" style="padding-bottom: 20rpx;">
-        <view class="label">
-            定制
-        </view>
-        <block wx:if="{{cWidth}}">
-            <view class="label custom" wx:if="{{cWidth.type == '自定义'}}">
-                <view style="display: flex; align-items: center;">
-                    <view style="margin-right: 10rpx;">宽:</view>
-                    <van-stepper plus-class='plus-class' value="{{ content.dwidth }}" input-width="60px" min="{{cWidth.min}}" max="{{cWidth.max}}" decimal-length="{{ cWidth.decimalplaces }}" data-name="cWidth" bind:plus='cahngeStepper' bind:blur='cahngeStepper' bind:minus='cahngeStepper' />
-                    <view class="explain">{{cWidth.min+'mm ~ '+ cWidth.max}}mm,<text wx:if="{{cWidth.decimalplaces}}">保留{{cWidth.decimalplaces}}位小数</text><text wx:else>不保留小数</text></view>
-                </view>
-            </view>
-            <view class="label custom" wx:else>
-                <view style="display: flex;">
-                    <view style="margin-right: 20rpx;margin-top: 30rpx;">宽:</view>
-                    <view class="product-box">
-                        <navigator url="#" class="product {{content.dwidth===item.num?'active':''}}" wx:for="{{cWidth.rowsdetail}}" wx:key="rowindex" bindtap="customParameter" data-valuename="dwidth" data-value="{{item.num}}">{{item.num}}</navigator>
-                    </view>
-                </view>
-            </view>
-        </block>
-        <block wx:if="{{cLength}}">
-            <view class="label custom" wx:if="{{cLength.type == '自定义'}}">
-                <view style="display: flex; align-items: center;">
-                    <view style="margin-right: 10rpx;">长:</view>
-                    <van-stepper plus-class='plus-class' value="{{ content.dlength  }}" input-width="60px" min="{{cLength.min}}" max="{{cLength.max}}" decimal-length="{{ cLength.decimalplaces }}" data-name="cLength" bind:plus='cahngeStepper' bind:blur='cahngeStepper' bind:minus='cahngeStepper' />
-                    <view class="explain">{{cLength.min+'mm ~ '+ cLength.max}}mm,<text wx:if="{{cLength.decimalplaces}}">保留{{cLength.decimalplaces}}位小数</text><text wx:else>不保留小数</text></view>
-                </view>
-            </view>
-            <view class="label custom" wx:else>
-                <view style="display: flex;">
-                    <view style="margin-right: 20rpx;margin-top: 30rpx;">长:</view>
-                    <view class="product-box">
-                        <navigator url="#" class="product {{content.dlength===item.num?'active':''}}" wx:for="{{cLength.rowsdetail}}" wx:key="rowindex" bindtap="customParameter" data-valuename="dlength" data-value="{{item.num}}">{{item.num}}</navigator>
-                    </view>
-                </view>
+        <customMade id="customMade">
+            <view slot='head' class="label">
+                {{labelList.custom}}
             </view>
-        </block>
+        </customMade>
     </view>
+
+    <block wx:if="{{detail.canuseactivity.length}}">
+        <view class="label" style="border: none;">
+            此商品正在促销
+        </view>
+        <navigator class="activity" wx:for="{{detail.canuseactivity}}" wx:key="sa_promotionid" wx:for-item='it' url="/packageA/activity/detail?id={{it.sa_promotionid}}">
+            {{it.promname}}
+        </navigator>
+        <view style="height: 1rpx;" />
+    </block>
+    <!-- 定制项 -->
+    <customMade id="customMade">
+        <view slot='head' class="label">
+            {{labelList.custom}}
+        </view>
+    </customMade>
 </view>
 <van-tabs custom-class='tabs' title-active-color='var(--assist)' color='var(--assist)'>
     <van-tab title="商品简介">
@@ -145,9 +126,16 @@
         </view>
         购物车
     </navigator>
-    <picker wx:if="{{detail.tradefield.length>=2}}" range='{{detail.tradefield}}' range-key='tradefield' bindchange='storage'>
-        <view class="bg-orange submit" bindtap="clickBut">加入购物车</view>
+    <navigator url="/packageA/favorites/index" class="action" style="height: 100%;display: flex; flex-direction: column; align-items: center;">
+        <view class="{{detail.iscollection?'cuIcon-favorfill':'cuIcon-favor'}}" style="color:{{detail.iscollection?'#FADB14':''}}">
+            <view class="cu-tag badge">{{favoriteCount}}</view>
+        </view>
+        收藏夹
+    </navigator>
+    <van-button custom-class="bg-blue submit" id='addToFavorites' disabled='{{itemCount!=selectCount}}' bind:click="clickBut">{{detail.iscollection?'取消收藏商品':'加入收藏夹'}}</van-button>
+    <picker wx:if="{{detail.tradefield.length>=2}}" range='{{detail.tradefield}}' disabled='{{itemCount!=selectCount}}' range-key='tradefield' bindchange='storage'>
+        <van-button custom-class="bg-orange submit" id='addToShoppingCart' disabled='{{itemCount!=selectCount}}' bind:click="clickBut">加入购物车</van-button>
     </picker>
-    <view wx:else class="bg-orange submit" bindtap="clickBut">加入购物车</view>
+    <van-button wx:else custom-class="bg-orange submit" id='addToShoppingCart' disabled='{{itemCount!=selectCount}}' bind:click="clickBut">加入购物车</van-button>
 </view>
 <wxs src="/utils/hidePrice.wxs" module="handleHide" />

+ 99 - 3
packageA/orderForm/add/add.js

@@ -9,6 +9,7 @@ Page({
         loading: false,
         sa_brandid: null,
         tradefield: null,
+        sa_accountclassid: 0,
         brandList: [],
         domainList: [],
         type: "标准订单",
@@ -18,8 +19,10 @@ Page({
         this.setData({
             type: e.currentTarget.dataset.name
         })
+        this.getAccList();
     },
     onLoad(options) {
+        this.getOrderList()
         this.setData({
             type: options.type || '标准订单',
             sa_projectid: options.sa_projectid || 0,
@@ -29,7 +32,35 @@ Page({
         if (this.data.userrole == '经销商') {
             this.getBrand();
             this.getDomain();
+        };
+
+
+        let domainrelatedaccounts = wx.getStorageSync('domainrelatedaccounts');
+        if (domainrelatedaccounts.length) {
+            this.setData({
+                domainrelatedaccounts
+            })
+        } else {
+            _Http.basic({
+                "classname": "sysmanage.develop.optiontype.optiontype",
+                "method": "optiontypeselect",
+                "content": {
+                    "pageNumber": 1,
+                    "pageSize": 9999,
+                    "typename": "domainrelatedaccounts"
+                }
+            }).then(res => {
+                console.log("查询领域对应列表", res)
+                if (res.msg == '成功' && res.data.length) {
+                    domainrelatedaccounts = res.data;
+                    wx.setStorageSync('domainrelatedaccounts', domainrelatedaccounts)
+                    this.setData({
+                        domainrelatedaccounts
+                    })
+                }
+            })
         }
+        console.log(domainrelatedaccounts)
     },
     /* 获取品牌 */
     getBrand(id) {
@@ -49,6 +80,29 @@ Page({
             });
         })
     },
+    /* 获取orderList */
+    getOrderList() {
+        _Http.basic({
+            "classname": "sysmanage.develop.optiontype.optiontype",
+            "method": "optiontypeselect",
+            "content": {
+                "typename": "ordertype"
+            }
+        }).then(res => {
+            console.log("订单类型", res)
+            let orderList = [];
+            try {
+                orderList = res.data.map(v => v.value);
+            } catch (error) {
+
+            }
+            if (orderList.length == 0) orderList.push("标准订单")
+            this.setData({
+                orderList,
+                type: orderList[0]
+            })
+        })
+    },
     /* 选择品牌 */
     onSelectBrand(e) {
         let {
@@ -80,6 +134,7 @@ Page({
                 tradefield: res.data[0].tradefield,
                 skeletonShow: false
             });
+            this.getAccList();
         })
     },
     /* 选择领域 */
@@ -91,6 +146,46 @@ Page({
         this.setData({
             tradefield: item.tradefield
         })
+        this.getAccList();
+    },
+    onSelectAcc(e) {
+        let {
+            item
+        } = e.currentTarget.dataset;
+        console.log(item)
+        this.setData({
+            sa_accountclassid: item.sa_accountclassid
+        })
+    },
+    getAccList() {
+        this.setData({
+            optionalAccount: [],
+            sa_accountclassid: 0
+        })
+        if (['标准订单', '特殊订单'].includes(this.data.type || '标准订单')) {
+            let tradefield = this.data.domainrelatedaccounts.find(v => v.value == this.data.tradefield);
+            if (tradefield) _Http.basic({
+                "id": 20221008134803,
+                "version": 1,
+                "content": {
+                    "pageNumber": 1,
+                    "pageTotal": 1,
+                    "pageSize": 9999,
+                    "where": {
+                        "condition": "",
+                        "isused": 1,
+                        "isnotspecialfund": this.data.type == '标准订单' ? 0 : 1, //是否专用
+                    },
+                }
+            }).then(res => {
+                console.log("账户列表", res)
+                let list = res.data.filter(v => tradefield.subvalues.some(s => s == v.sa_accountclassid))
+                if (res.msg == '成功') this.setData({
+                    optionalAccount: list,
+                    sa_accountclassid: list.length ? list[0].sa_accountclassid : 0
+                })
+            })
+        }
     },
     submit() {
         if (this.data.userrole == '业务员' && !this.data.agency.sys_enterpriseid) {
@@ -120,15 +215,16 @@ Page({
                 "sa_brandid": this.data.sa_brandid, //品牌ID
                 "type": this.data.type, //订单类型
                 "tradefield": this.data.tradefield, //必选
-                sys_enterpriseid: this.data.agency.sys_enterpriseid
+                sys_enterpriseid: this.data.agency.sys_enterpriseid,
+                sa_accountclassid: this.data.sa_accountclassid
             }
         }).then(res => {
             this.setData({
                 loading: false
             })
-            console.log("创建标准订单", res);
+            console.log("创建" + this.data.type, res);
             wx.showToast({
-                title: res.msg != '成功' ? res.msg : '创建成功',
+                title: res.msg != '成功' ? res.msg || '创建失败' : '创建成功',
                 icon: "none",
                 mask: true
             });

+ 9 - 2
packageA/orderForm/add/add.wxml

@@ -22,8 +22,7 @@
         订单类型
     </view>
     <view class="content">
-        <van-button custom-class='but {{type=="标准订单"?"active":""}}' data-name="标准订单" bindtap="onSelectType">标准订单</van-button>
-        <van-button custom-class='but {{type=="特殊订单"?"active":""}}' data-name="特殊订单" bindtap="onSelectType">特殊订单</van-button>
+        <van-button wx:for="{{orderList}}" custom-class='but {{type==item?"active":""}}' data-name="{{item}}" bindtap="onSelectType">{{item}}</van-button>
     </view>
 </view>
 <view class="groud" wx:if="{{brandList.length}}">
@@ -43,6 +42,14 @@
     </view>
 </view>
 
+<view class="groud" wx:if="{{optionalAccount.length>1}}">
+    <view class="label">
+        选择账户
+    </view>
+    <view class="content">
+        <van-button custom-class='but {{item.sa_accountclassid==sa_accountclassid?"active":""}}' wx:for="{{optionalAccount}}" wx:key="sa_accountclassid" data-item="{{item}}" bindtap="onSelectAcc">{{item.accountname}}</van-button>
+    </view>
+</view>
 
 <!-- 底部 -->
 <view style="height: 150rpx;" />

+ 10 - 1
packageA/orderForm/detail.js

@@ -27,7 +27,8 @@ Page({
 			label: "物流单",
 			icon: "icon-shouhuo",
 			model: "#Shipments"
-		}]
+		}],
+		specialProductQuantity: 0
 	},
 	onLoad(options) {
 		this.setData({
@@ -89,6 +90,14 @@ Page({
 			}
 		})
 	},
+	/* 特殊订单使用,获取产品数量 */
+	getProductCount({
+		detail
+	}) {
+		this.setData({
+			specialProductQuantity: detail
+		})
+	},
 	/* 免运费信息 */
 	setLogisticsMsg() {
 		let logistics = null;

+ 11 - 4
packageA/orderForm/detail.wxml

@@ -18,7 +18,7 @@
     <view class="exp">创建日期:{{detail.createdate}}</view>
     <!-- <van-button wx:if="{{userrole=='经销商'}}" custom-class='copy' bindtap="copyItem">一键复制订单</van-button> -->
 </view>
-<navigator url="#" class="box location" bindtap="selectFinance">
+<!-- <navigator url="#" class="box location" bindtap="selectFinance">
     <view class="content">
         <view class="name">
             开票单位
@@ -28,7 +28,7 @@
         </view>
     </view>
     <view class="iconfont icon-dibu-bianji" />
-</navigator>
+</navigator> -->
 <view class="box pay">
     <view class="title">
         支付信息
@@ -55,10 +55,17 @@
         <view class="label">订单备注</view>
         <textarea disabled="{{detail.status!='新建'}}" bindtap="isEdit" class="remarks" placeholder-class='placeholder' bindblur="changeRemarks" value="{{detail.remarks}}" auto-height placeholder="订单备注" />
     </view>
+
+    <view class="row">
+        <view class="label">摘要</view>
+        <view>
+            {{detail.abstract||' --'}}
+        </view>
+    </view>
 </view>
 <view style="height: 20rpx;" />
 <Yl_FunTabs list='{{tabsList}}' active='{{tabsActive}}' bind:onChenge="tabsChange">
-    <Product slot='产品明细' id='Product' disabled="{{detail.status!='新建'}}" sa_order_v='{{detail.sa_order_v}}' />
+    <Product slot='产品明细' id='Product' disabled="{{detail.status!='新建'}}" sa_order_v='{{detail.sa_order_v}}' bind:returnProductCount='getProductCount' />
     <Yl_Attachment slot='附件' id='Yl_Attachment' ownertable="sa_order" ownerid="{{detail.sa_orderid}}" disabled="{{detail.status!='新建'}}" />
     <Progress slot='订单进度' id='Progress' />
     <Consignment slot='出库单' id='Consignment' />
@@ -80,7 +87,7 @@
         <block wx:if="{{detail.type=='特殊订单'}}">
             <van-button custom-class='but' wx:if="{{detail.status=='新建' && enable.query(options,'insubmit')}}" data-isrecheck="1" bind:click="presubmission">预提交</van-button>
             <van-button custom-class='but' wx:if="{{detail.status=='预提交' && enable.query(options,'revocation')}}" data-isrecheck="0" bind:click="presubmission">撤回</van-button>
-            <van-button custom-class='but' wx:if="{{detail.status=='确认' && enable.query(options,'submit')}}" disabled="{{detail.amount<=0}}" bind:click="submit">提交订单</van-button>
+            <van-button custom-class='but' wx:if="{{detail.status=='确认' && enable.query(options,'submit')}}" disabled="{{specialProductQuantity<=0}}" bind:click="submit">提交订单</van-button>
         </block>
         <block wx:else>
             <van-button custom-class='but' wx:if="{{detail.status=='新建' && enable.query(options,'submit')}}" disabled="{{detail.amount<=0}}" bind:click="submit">提交订单</van-button>

+ 65 - 0
packageA/orderForm/index.js

@@ -51,6 +51,7 @@ Page({
     this.getList()
     this.getBrand()
     this.getDomain()
+    this.getOrderList()
   },
   /* 获取产品 */
   getList(init = false) {
@@ -149,6 +150,26 @@ Page({
       if (res.msg == '成功') this.data.brandList = res.data
     })
   },
+  /* 获取orderList */
+  getOrderList() {
+    _Http.basic({
+      "classname": "sysmanage.develop.optiontype.optiontype",
+      "method": "optiontypeselect",
+      "content": {
+        "typename": "ordertype"
+      }
+    }).then(res => {
+      console.log("订单类型", res)
+      let orderList = [];
+      try {
+        orderList = res.data.map(v => v.value);
+      } catch (error) {}
+      if (orderList.length == 0) orderList.push("标准订单")
+      this.setData({
+        orderList
+      })
+    })
+  },
   /* 获取领域 */
   getDomain() {
     _Http.basic({
@@ -191,8 +212,52 @@ Page({
     }, 300);
   },
   createOrder() {
+<<<<<<< HEAD
     wx.navigateTo({
       url: '/packageA/orderForm/add/add?type=标准订单',
     })
+=======
+    let orderList = this.data.orderList;
+    if (this.data.brandList.length == 1 && this.data.filtratelist[1].list.length == 1 && orderList.length == 1) {
+      wx.showModal({
+        title: '提示',
+        content: `是否确定创建${orderList[0]}`,
+        complete: ({
+          confirm
+        }) => {
+          if (confirm) _Http.basic({
+            "id": 20221108111402,
+            content: {
+              sa_orderid: 0,
+              rec_contactsid: 0,
+              pay_enterpriseid: 0,
+              sa_contractid: 0,
+              sa_projectid: 0,
+              "sa_brandid": this.data.brandList[0].sa_brandid, //品牌ID
+              "type": orderList[0], //订单类型
+              "tradefield": this.data.filtratelist[1].list[0].tradefield, //必选
+              sys_enterpriseid: 0
+            }
+          }).then(res => {
+            console.log(`创建${orderList[0]}`, res);
+            wx.showToast({
+              title: res.msg != '成功' ? res.msg : '创建成功',
+              icon: "none",
+              mask: true
+            });
+            if (res.msg == '成功') setTimeout(() => {
+              wx.navigateTo({
+                url: '/packageA/orderForm/detail?id=' + res.data.sa_orderid,
+              });
+            }, 500)
+          })
+        }
+      })
+    } else {
+      wx.navigateTo({
+        url: '/packageA/orderForm/add/add?type=标准订单',
+      })
+    }
+>>>>>>> 德莱宝测试除了手机登录不合并
   }
 })

+ 5 - 0
packageA/orderForm/modules/product/index.js

@@ -17,6 +17,9 @@ Component({
         disabled: {
             type: Boolean
         }, //禁用
+        returnProductCount: {
+            type: Function
+        }
     },
     data: {
         content: {
@@ -68,6 +71,7 @@ Component({
                     sa_contractid: page.sa_contractid,
                     type: page.type,
                 };
+                this.triggerEvent("returnProductCount", res.total)
                 this.setData({
                     list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
                     "content.pageNumber": res.pageNumber + 1,
@@ -140,6 +144,7 @@ Component({
                         that.setData({
                             list: that.data.list.filter(v => v.sa_orderitemsid != detail.sa_orderitemsid)
                         });
+                        this.triggerEvent("returnProductCount", this.data.content.total - 1)
                         this.updateThePrice();
                     })
                 }

+ 2 - 1
packageA/returnOne/index.js

@@ -33,7 +33,8 @@ Page({
 	},
 	onLoad(options) {
 		this.setData({
-			userrole: wx.getStorageSync('userrole')
+			userrole: wx.getStorageSync('userrole'),
+			insert: wx.getStorageSync('auth').wreturn.options.some(v => v == 'insert'), //查询新增权限
 		})
 		this.getList(true)
 	},

+ 1 - 1
packageA/returnOne/index.wxml

@@ -16,7 +16,7 @@
 		<view style="height: 20px;" />
 	</Yl_ListBox>
 </view>
-<Yl_FloatingButton bindtap="toAdd" />
+<Yl_FloatingButton wx:if="{{insert}}" bindtap="toAdd" />
 <view class="DrawerClose {{modalName=='viewModal'?'show':''}}" bindtap="hideModal">
 	<text class="cuIcon-pullright"></text>
 </view>

+ 29 - 26
pages/index/collect/index.js

@@ -5,6 +5,9 @@ const _Http = getApp().globalData.http,
 		precision: 2
 	}).format();
 let downCount = {};
+import {
+	getCustomText
+} from "../../../utils/customItemType";
 Component({
 	options: {
 		addGlobalClass: true,
@@ -16,37 +19,36 @@ Component({
 		sa_brandid: null, //当前选中品牌id
 		classList: [], //生成订单时所选
 		sum: 0, //价格合
-		allBrandList: []
+		allBrandList: [],
+		hidePrice: wx.getStorageSync('hidePrice'),
 	},
 	methods: {
 		init() {
 			this.getList()
-			this.setData({
-				hidePrice: wx.getStorageSync('hidePrice'),
-			})
-			getApp().globalData.customizedProduct = this.customizedProduct.bind(this);
-			return true;
-		},
-		customizedProduct(item) {
-			return new Promise((resolve) => {
-				_Http.basic({
-					"id": 20220924104302,
-					"content": {
-						"sa_shoppingcartid": item.sa_shoppingcartid,
-						"qty": item.qty,
-						"width": item.width || 0,
-						"length": item.length || 0
-					},
-				}).then(res => {
-					console.log("修改定制", res)
-					wx.showToast({
-						title: res.msg != '成功' ? res.msg : '修改成功',
-						icon: "none"
-					});
-					this.getList()
-					resolve(true)
+			getApp().globalData.customizedProduct = (item, custom) => {
+				return new Promise((resolve) => {
+					wx.showLoading({
+						title: '修改中...',
+					})
+					_Http.basic({
+						"id": 20220924104302,
+						"content": {
+							"sa_shoppingcartid": item.sa_shoppingcartid,
+							"qty": item.qty,
+							...custom
+						},
+					}).then(res => {
+						console.log("修改定制", res)
+						wx.showToast({
+							title: res.msg != '成功' ? res.msg : '修改成功',
+							icon: "none"
+						});
+						this.getList()
+						resolve(true)
+					})
 				})
-			})
+			}
+			return true;
 		},
 		/* 获取列表 */
 		getList() {
@@ -83,6 +85,7 @@ Component({
 							results: [v.sa_shoppingcartid],
 						})
 					}
+					if (v.iscustomsize) v.customText = getCustomText(v);
 					return v
 				});
 				this.setData({

+ 3 - 3
pages/index/collect/index.wxml

@@ -16,12 +16,12 @@
 						<van-checkbox shape='square' disabled="{{sa_brandid && sa_brandid!=item.sa_brandid}}" icon-size='24rpx' value="{{ decide.checked(item.sa_shoppingcartid,results) }}" />
 					</view>
 					<view class="exp">编号:{{item.itemno}}</view>
-					<!-- <view class="exp">规格:{{item.spec ||" --"}}</view> -->
 					<view class="exp">型号:{{item.model ||" --"}}</view>
 					<view class="exp">品牌:{{item.brandname ||" --"}}</view>
 					<view class="exp">领域:{{item.tradefield_shoppingcart ||" --"}}</view>
 					<view class="exp" wx:if="{{item.iscustomsize}}" data-item="{{item}}" catch:tap="customization" style="color:#085CDF;">
-						长:{{item.length}} / 宽:{{item.width}} <van-icon name="arrow-down" />
+						{{item.customText}}
+						<van-icon name="arrow-down" />
 					</view>
 					<view class="price" style="bottom: {{item.iscustomsize?'40rpx':'0rpx'}};">{{handleHide.query(item.showPrice,hidePrice)}}/{{item.unitname}}</view>
 				</view>
@@ -36,7 +36,7 @@
 		<view slot="right" class="cell-right">删 除</view>
 	</van-swipe-cell>
 	<Yl_Empty wx:if="{{list.length === 0}}" />
-	<view style="height: 200px;" />
+	<view style="height: 120px;" />
 </Yl_ListBox>
 <view class="footer-box">
 	<view class="footer">

+ 25 - 68
pages/index/collect/modules/custom.js

@@ -1,8 +1,13 @@
 const _Http = getApp().globalData.http;
+
 Component({
   properties: {
     isOldPrice: {
       type: Boolean
+    },
+    prefix: {
+      type: String,
+      value: ""
     }
   },
   data: {
@@ -11,53 +16,35 @@ Component({
   },
   methods: {
     onClick(item) {
-      console.log(item)
       if (this.data.product != null && item.itemid == this.data.product.itemid) return this.setData({
         show: true
       })
       wx.showLoading({
         title: '获取定制方案中..',
       })
-      Promise.all([{
-        "id": "20230707091603",
-        "version": 1,
-        "content": {
-          "sa_sizecustomizedschemeid": item.lengthschemeid,
-          date: Date.now()
-        }
-      }, {
-        "id": "20230707091603",
-        "version": 1,
-        "content": {
-          "sa_sizecustomizedschemeid": item.widthschemeid,
-          date: Date.now() + 2
-        }
-      }].map(v => _Http.basic(v))).then(s => {
-        console.log("获取定制方案", s)
+      this.selectComponent("#customMade").init(item, this.data.prefix).then(res => {
         wx.hideLoading();
-        if (s.some(c => c.msg != '成功')) return wx.showToast({
-          title: '定制方案获取失败',
-          icon: "none"
-        })
-        s[0].data.name = '长度'
-        if (!item.length) item.length = s[0].data.type == '可选' ? s[0].data.rowsdetail[0].num : s[0].data.min - 0;
-        console.log("长度id", item.lengthschemeid, '长:' + item.length, '结果:', s[0].data.sa_sizecustomizedschemeid)
-        s[1].data.name = '宽度'
-        if (!item.width) item.width = s[1].data.type == '可选' ? s[1].data.rowsdetail[0].num : s[1].data.min - 0;
-        console.log("宽度id", item.widthschemeid, '宽:' + item.width, '结果:', s[1].data.sa_sizecustomizedschemeid)
-        this.setData({
-          show: true,
-          arr: [s[0].data, s[1].data],
-          product: item
-        });
-      });
-
+        if (res) {
+          this.setData({
+            show: true
+          })
+        } else {
+          wx.showToast({
+            title: '未获取到定制方案',
+            icon: "none"
+          })
+        }
+      })
       this.selectComponent("#Dialog").data.beforeClose = (action) => new Promise((resolve) => {
         if (action === 'confirm') {
-          //getItem(this.data.product, this.data.isOldPrice ? "oldprice" : "")
-          getApp().globalData.customizedProduct(this.data.product).then(res => {
-            resolve(true);
-          })
+          let custom = {
+            length: 0,
+            width: 0
+          };
+          //是否为定制项
+          custom = this.selectComponent("#customMade").getResult(true);
+          if (typeof custom == "boolean") return resolve(false);
+          getApp().globalData.customizedProduct(item, custom).then(res => resolve(true))
         } else {
           resolve(false);
           this.setData({
@@ -65,36 +52,6 @@ Component({
           })
         }
       });
-    },
-    selected(e) {
-      const {
-        name,
-        num
-      } = e.currentTarget.dataset;
-      this.data.product[name] = num;
-      this.setData({
-        product: this.data.product
-      })
-    },
-    /* 定制步进器 */
-    cahngeStepper(e) {
-      const {
-        name,
-        item
-      } = e.currentTarget.dataset,
-        product = this.data.product;
-      if (e.type == 'plus') {
-        product[name] += 1
-      } else if (e.type == 'minus') {
-        product[name] -= 1
-      } else {
-        product[name] = (e.detail.value - 0).toFixed(product.decimalplaces);
-      }
-      if (product[name] > item.max) product[name] = item.max;
-      if (product[name] < item.min) product[name] = item.min;
-      this.setData({
-        product
-      })
     }
   }
 })

+ 2 - 1
pages/index/collect/modules/custom.json

@@ -2,6 +2,7 @@
   "component": true,
   "usingComponents": {
     "van-dialog": "@vant/weapp/dialog/index",
-    "van-stepper": "@vant/weapp/stepper/index"
+    "van-stepper": "@vant/weapp/stepper/index",
+    "customMade": "./customMade/index"
   }
 }

+ 11 - 39
pages/index/collect/modules/custom.scss

@@ -1,44 +1,16 @@
-.box {
-	width: 100%;
-	padding: 0 30rpx 20rpx;
-	box-sizing: border-box;
+.external-custom-stepper-box {
+	display: block !important;
+}
 
-	.item {
-		display: flex;
-		margin-top: 20rpx;
+.external-explain {
+	margin: 10rpx 0 !important;
+}
 
-		.label {
-			font-weight: 700;
-		}
+.external-custom-option {
+	font-size: 24rpx;
+}
 
-		.selectable {
-			display: flex;
-			flex-wrap: wrap;
 
-			.num {
-				border: 1px solid #ddd;
-				margin-right: 8rpx;
-				padding: 4rpx 15rpx;
-				border-radius: 8rpx;
-				font-size: 26rpx;
-				margin-bottom: 10rpx;
-			}
-
-			.active {
-				border: 1px solid #085CDF;
-				color: #085CDF;
-				font-weight: 700;
-			}
-		}
-
-		.stepper {
-
-			.explain {
-				font-size: 24rpx;
-				color: #999;
-				margin-top: 6rpx;
-			}
-		}
-
-	}
+.external-active {
+	color: #085CDF;
 }

+ 2 - 15
pages/index/collect/modules/custom.wxml

@@ -1,18 +1,5 @@
 <van-dialog id="Dialog" use-slot title="定制" show="{{ show }}" asyncClose confirm-button-color='#085CDF' show-cancel-button>
-	<view class="box">
-		<view class="item" wx:for="{{arr}}" wx:key="name">
-			<view class="label">
-				{{item.name}}:
-			</view>
-			<view class="selectable" wx:if="{{item.type=='可选'}}">
-				<view class="num {{product[item.name=='宽度'?'width':'length']==it.num?'active':''}}" wx:for="{{item.rowsdetail}}" wx:for-item='it' wx:for-index='i' wx:key="rowno" data-name="{{item.name=='宽度'?'width':'length'}}" data-num="{{it.num}}" catch:tap='selected'>
-					{{it.num}}
-				</view>
-			</view>
-			<view class="stepper" wx:else>
-				<van-stepper value="{{ product[ item.name=='宽度'?'width':'length'] }}" input-width="60px" min="{{item.min}}" max="{{item.max}}" decimal-length="{{ item.decimalplaces }}" data-item="{{item}}" data-name="{{ item.name=='宽度'?'width':'length' }}" bind:plus='cahngeStepper' bind:blur='cahngeStepper' bind:minus='cahngeStepper' />
-				<view class="explain">{{item.min+'mm ~ '+ item.max}}mm,<text wx:if="{{item.decimalplaces}}">保留{{item.decimalplaces}}位小数</text><text wx:else>不保留小数</text></view>
-			</view>
-		</view>
+	<view style="padding: 20rpx;box-sizing: border-box;">
+		<customMade id="customMade" external-custom-stepper-box='external-custom-stepper-box' external-explain='external-explain' external-active='external-active' external-custom-option='external-custom-option' />
 	</view>
 </van-dialog>

+ 89 - 0
pages/index/collect/modules/customMade/index.js

@@ -0,0 +1,89 @@
+import {
+  getCustomItems
+} from "../../../../../utils/customItemType";
+
+Component({
+  properties: {
+    topHei: {
+      type: String,
+      value: "20rpx"
+    },
+    onChange: {
+      type: Function
+    }
+  },
+  options: {
+    multipleSlots: true
+  },
+  externalClasses: ["external-custom-box", "external-custom-label", "external-custom-stepper-box", "external-explain", "external-active", "external-custom-option"],
+  data: {
+    list: []
+  },
+  methods: {
+    init(data, prefix = '') {
+      return new Promise((resolve) => {
+        getCustomItems(data, prefix).then(list => {
+          this.setData({
+            list
+          });
+          this.getResult();
+          resolve(list.length);
+        });
+      });
+    },
+    onOption(e) {
+      const {
+        index,
+        value
+      } = e.currentTarget.dataset;
+      if (this.data.list[index].value == value) return;
+      this.setData({
+        [`list[${index}].value`]: value
+      });
+      this.getResult();
+    },
+    getResult(isSubmit) {
+      let obj = {};
+      let breakOff = false;
+      this.data.list.filter(v => {
+        if (breakOff) return;
+        if (v.type == '自定义') {
+          if (!v.value) v.value = 0;
+          if (v.value < v.min) v.value = v.min;
+        }
+        obj[v.key] = v.value || '';
+        if (isSubmit && !obj[v.key]) {
+          wx.showToast({
+            title: `请完成定制"${v.label}"选项`,
+            icon: "none"
+          })
+          breakOff = true;
+        }
+      })
+      this.triggerEvent("onChange", breakOff ? false : obj)
+      return breakOff ? false : obj
+    },
+    /* 定制步进器 */
+    changeStepper(e) {
+      const {
+        index,
+        item
+      } = e.currentTarget.dataset;
+      if (!item.value) item.value = 0;
+      if (e.type == 'plus') {
+        item.value += 1
+      } else if (e.type == 'minus') {
+        item.value -= 1
+      } else {
+        item.value = (e.detail.value - 0).toFixed(item.decimalplaces);
+      }
+      item.value = item.value - 0;
+      if (item.value > item.max) item.value = item.max;
+      if (item.value < item.min) item.value = item.min;
+      this.setData({
+        [`list[${index}]`]: item
+      })
+      this.getResult();
+    },
+  }
+})

+ 6 - 0
pages/index/collect/modules/customMade/index.json

@@ -0,0 +1,6 @@
+{
+  "component": true,
+  "usingComponents": {
+    "van-stepper": "@vant/weapp/stepper/index"
+  }
+}

+ 39 - 0
pages/index/collect/modules/customMade/index.scss

@@ -0,0 +1,39 @@
+.custom {
+	display: flex;
+	flex-wrap: wrap;
+	margin-bottom: 6rpx;
+
+	&-label {
+		font-size: 28rpx;
+		font-weight: bold;
+		color: #333333;
+		margin-top: 4rpx;
+	}
+
+	&-option {
+		background-color: #F4F5F7;
+		padding: 8rpx 20rpx;
+		border-radius: 8rpx;
+		overflow: hidden;
+		margin-right: 12rpx;
+		margin-bottom: 14rpx;
+	}
+
+	&-option:last-child {
+		margin-right: 0;
+	}
+
+	.active {
+		background: #E7EEFF !important;
+	}
+
+	.stepper-box {
+		display: flex;
+		align-items: center;
+	}
+
+	.explain {
+		font-size: 22rpx;
+		color: #333;
+	}
+}

+ 19 - 0
pages/index/collect/modules/customMade/index.wxml

@@ -0,0 +1,19 @@
+<view hidden="{{!list.length}}">
+	<slot name='head' />
+	<view style="height: {{topHei}};" />
+</view>
+<view class="custom external-custom-box" wx:for="{{list}}" wx:key="sa_sizecustomizedschemeid">
+	<view class="custom-label external-custom-label">
+		{{item.label}}:
+	</view>
+	<!-- 可选项 -->
+	<block wx:if="{{item.type=='可选'}}">
+		<navigator url="#" class="custom-option {{it.num == item.value?'active external-active':''}} external-custom-option" data-value="{{it.num}}" data-index="{{index}}" wx:for="{{item.rowsdetail}}" wx:for-item="it" wx:for-index="i" wx:key="sa_sizeschemedetailid" bindtap="onOption">
+			{{it.num}}
+		</navigator>
+	</block>
+	<view class="stepper-box external-custom-stepper-box" wx:elif="{{item.type=='自定义'}}">
+		<van-stepper value="{{item.value||0}}" data-item="{{item}}" data-index="{{index}}" input-width="60px" min="{{item.min}}" max="{{item.max}}" decimal-length="{{ item.decimalplaces }}" bind:plus='changeStepper' bind:blur='changeStepper' bind:minus='changeStepper' />
+		<view class="explain external-explain">{{item.min+'mm ~ '+ item.max}}mm,<text wx:if="{{item.decimalplaces}}">保留{{item.decimalplaces}}位小数</text><text wx:else>不保留小数</text></view>
+	</view>
+</view>

+ 44 - 4
pages/index/index.js

@@ -9,7 +9,8 @@ Page({
 	data: {
 		PageCur: 'Home',
 		collectCount: "", //购物车商品数量
-		msgList: []
+		msgList: [],
+		favoriteCount: 0, //收藏夹数量
 	},
 	onLoad(options) {
 		pageInit = {
@@ -23,7 +24,10 @@ Page({
 			PageCur: options.PageCur
 		})
 		this.refreshData();
+
 		this.getCollectCount();
+		this.getFavoriteCount();
+
 		this.updateMsgCount();
 		this.getAnnunciate();
 		if (getApp().globalData.remindchangepassword_str) wx.showModal({
@@ -78,6 +82,8 @@ Page({
 	 */
 	refreshData() {
 		getApp().globalData.getCollectCount = this.getCollectCount.bind(this); //更新购物车件数
+		getApp().globalData.getFavoriteCount = this.getFavoriteCount.bind(this); //更新收藏夹件数
+
 		getApp().globalData.socketCallback = this.updateMsgCount.bind(this); //更新信息数量
 		getApp().globalData.changeBar = this.cutBar.bind(this); //切换首页页面
 		let page = this.selectComponent("#Home");
@@ -140,52 +146,69 @@ Page({
 			function getedd() {
 				let paths = [{
 					name: "商城",
+					key: "wmarket",
 					PageCur: "Market",
 					icon: "work-shangcheng"
 				}, {
 					name: "订货单",
+					key: "worderform",
 					path: "/packageA/orderForm/index",
 					icon: "work-dingdan"
 				}, {
 					name: "订单明细",
+					key: "worderdetails",
 					path: "/packageA/orderForm/rows",
 					icon: "work-dingdan"
 				}, {
 					name: "账户",
+					key: "waccount",
 					path: "/packageA/account/index",
 					icon: "work-zhanghu"
 				}, {
 					name: "促销活动",
+					key: "wdiscounts",
 					path: "/packageA/activity/index",
 					icon: "work-cuxiaohuodong"
 				}, {
 					name: "打款凭证",
+					key: "wpaymentdocument",
 					path: "/packageA/remitVoucher/index",
 					icon: "work-dakuanpingzheng"
 				}, {
 					name: "物流单",
+					key: "wlogisticsbill",
 					path: "/packageA/shipment/index",
 					icon: "icon-shouhuo"
 				}, {
 					name: "返退申请单",
+					key: "wreturn",
 					path: "/packageA/returnOne/index",
 					icon: "work-shujuchaxun"
 				}, {
 					name: "发货单",
+					key: "wdispatch",
 					path: "/packageA/dispatchBill/index",
 					icon: "icon-shouhuo"
 				}, {
 					name: "发货明细",
+					key: "wdeliverydetail",
 					path: "/packageA/dispatchBill/rows",
 					icon: "icon-shouhuo"
 				}, {
 					name: "工厂发退明细",
+					key: "wsentandback",
 					path: "/packageA/dispatchBill/sentandback",
 					icon: "icon-shouhuo"
 				}, {
 					name: "业绩目标",
+					key: "wtarget",
 					path: "/packageA/target/index",
 					icon: "work-yejimubiao"
+				}, {
+					name: "收藏夹",
+					key: "wfavorites",
+					path: "/packageA/favorites/index",
+					icon: "work-webshoucang"
 				}];
 				let edd = getApp().globalData.queryPer.query(wx.getStorageSync('userauth'), ["E-订单"], ["商品档案", "销售管理", "财务管理", "售后管理", "发货管理", "业绩查询"]),
 					list = [];
@@ -196,8 +219,9 @@ Page({
 							optionnames: s.meta.auth.map(a => a.optionname),
 						}
 						if (authList[s.name].options.some(s => s == "read")) {
-							let i = paths.findIndex(k => k.name == s.meta.title);
+							let i = paths.findIndex(k => k.key == s.name || k.name == s.meta.title);
 							if (i != -1) {
+								paths[i].name = s.meta.title;
 								paths[i].index = i;
 								paths[i].isneedpay = s.isneedpay;
 								list.push(paths[i])
@@ -276,8 +300,6 @@ Page({
 			setTimeout(this.refreshData, 10);
 			return;
 		}
-
-
 	},
 	/* 获取通告列表 */
 	/**
@@ -297,6 +319,24 @@ Page({
 			return res.data.num;
 		});
 	},
+	/* 更新收藏夹数量 */
+
+	getFavoriteCount() {
+		return _Http.basic({
+			"id": 20231121145103,
+			"content": {
+				pageSize: 1,
+				nocache: true
+			}
+		}).then(res => {
+			console.log("收藏夹数量", res)
+			getApp().globalData.favoriteCount = res.total;
+			this.setData({
+				favoriteCount: res.data.num
+			})
+			return res.total;
+		});
+	},
 	/* 更新消息数量 */
 	updateMsgCount() {
 		pageInit.Message = false;

+ 1 - 1
pages/index/market/index.wxml

@@ -1,6 +1,6 @@
 <view class="DrawerPage {{modalName=='viewModal'?'show':''}}">
 	<van-search use-action-slot placeholder='请输入搜索关键词' shape='round' bind:search="onSearch" bind:clear="onSearch">
-		<view slot="action" class="cuIcon-filter search-right" bindtap="showModal" data-target="viewModal">
+		<view wx:if="{{filtratelist[0].list.length>1}}" slot="action" class="cuIcon-filter search-right" bindtap="showModal" data-target="viewModal">
 			筛选
 		</view>
 	</van-search>

+ 7 - 0
project.private.config.json

@@ -78,6 +78,13 @@
           "query": "",
           "launchMode": "default",
           "scene": null
+        },
+        {
+          "name": "商品详情",
+          "pathName": "packageA/market/detail",
+          "query": "params=%7B%22sa_itemgroupid%22%3A6009%2C%22sa_brandid%22%3A47%7D",
+          "launchMode": "default",
+          "scene": null
         }
       ]
     }

+ 20 - 12
select/product/index.js

@@ -1,6 +1,12 @@
 const _Http = getApp().globalData.http,
 	file = require("../../utils/FormatTheAttachment");
 import currency from "../../utils/currency";
+
+import {
+	getCustomText
+} from "../../utils/customItemType";
+
+
 Page({
 	data: {
 		hidePrice: wx.getStorageSync('hidePrice'),
@@ -29,19 +35,20 @@ Page({
 			newPrice: options.newprice || "price", //红色价格
 		});
 		this.getList();
-		getApp().globalData.customizedProduct = this.customizedProduct.bind(this);
-	},
-	customizedProduct(item) {
-		return new Promise((resolve) => {
-			let index = this.data.list.findIndex(v => v[this.data.idname] == item[this.data.idname]);
-			if (index != -1) this.data.list[index] = item;
-			if (item.pitchOn) this.data.result.push(item[this.data.idname])
-			this.setData({
-				list: this.data.list,
-				result: this.data.result
+		getApp().globalData.customizedProduct = (item, custom) => {
+			return new Promise((resolve) => {
+				item = Object.assign(item, custom)
+				item.customText = getCustomText(item);
+				let index = this.data.list.findIndex(v => v[this.data.idname] == item[this.data.idname]);
+				if (index != -1) this.data.list[index] = item;
+				if (item.pitchOn) this.data.result.push(item[this.data.idname])
+				this.setData({
+					list: this.data.list,
+					result: this.data.result
+				})
+				resolve(true)
 			})
-			resolve(true)
-		})
+		}
 	},
 	getList(init = false) {
 		//init 用于初始化分页
@@ -74,6 +81,7 @@ Page({
 				value.qty = value.orderminqty;
 				value.width = 0;
 				value.length = 0;
+				if (value.iscustomsize) value.customText = getCustomText(value);
 				return value;
 			})
 			this.setData({

+ 1 - 1
select/product/index.wxml

@@ -37,7 +37,7 @@
                     包装数量:{{item.packageqty}}
                 </view>
                 <view wx:if="{{item.iscustomsize}}" class="subfield line-1" data-item="{{item}}" catch:tap="customization" style="color:#085CDF;">
-                    长:{{item.length}} / 宽:{{item.width}}
+                    {{item.customText}}
                     <van-icon name="arrow-down" />
                 </view>
                 <view class="price line-1">

+ 52 - 0
static/work-icon.wxss

@@ -9,6 +9,58 @@
 }
 
 
+.work {
+	font-family: "work" !important;
+	font-size: 16px;
+	font-style: normal;
+	-webkit-font-smoothing: antialiased;
+	-moz-osx-font-smoothing: grayscale;
+}
+
+.work-webshoucang:before {
+	content: "\e68a";
+}
+
+.work-kehuhuaxiang:before {
+	content: "\e699";
+}
+
+.work-xiangmuchengjiaoyuce:before {
+	content: "\e69a";
+}
+
+.work-xiangmuchengjiaoyuceguanli:before {
+	content: "\e69b";
+}
+
+.work-xiangmuhuaxiang:before {
+	content: "\e69c";
+}
+
+.work-chuhuokaipiaoyuce:before {
+	content: "\e69d";
+}
+
+.work-chuhuokaipiaoyuceguanli:before {
+	content: "\e69e";
+}
+
+.work-xiaoshouloudou:before {
+	content: "\e69f";
+}
+
+.work-yewuyuanhuaxiang:before {
+	content: "\e6a0";
+}
+
+.work-zuoyekanban:before {
+	content: "\e697";
+}
+
+.work-gongzuohuibao:before {
+	content: "\e601";
+}
+
 .work-xiaoxigundong:before {
 	content: "\e674";
 }

Plik diff jest za duży
+ 0 - 0
static/work.wxss


+ 4 - 1
utils/Http.js

@@ -2,9 +2,12 @@ class HTTP {
 	constructor() {
 		let ENV = wx.getAccountInfoSync().miniProgram.envVersion;
 		if (ENV === 'release') { // 正式版
-			this.baseUrl = "https://cucu.cnyunl.com:8079";
+			// this.baseUrl = "https://lsa.cnyunl.com";
+			this.baseUrl = "https://www.cnyunl.com";
 		} else {
+			// this.baseUrl = "https://www.cnyunl.com";
 			this.baseUrl = "http://61.164.207.46:8200";
+			// this.baseUrl = "https://cucu.cnyunl.com:8079";
 		}
 		console.log("接口地址:", this.baseUrl)
 	}

+ 68 - 0
utils/customItemType.js

@@ -0,0 +1,68 @@
+function getLabelList() {
+	let siteCustomLabel = {
+		"default": {
+			width: "宽",
+			length: "长",
+			cheek: "边框",
+			color: "颜色",
+			material: "基材",
+			spec: "尺寸",
+			custom: "定制"
+		},
+		"DLB": {
+			width: "宽",
+			length: "长",
+			cheek: "工艺",
+			color: "颜色",
+			material: "选项",
+			spec: "尺寸",
+			custom: "定制"
+		}
+	};
+	return siteCustomLabel[wx.getStorageSync('siteP').siteid] || siteCustomLabel.default
+}
+
+function getCustomItems(data, prefix = '') {
+	const _Http = getApp().globalData.http;
+	let labelList = getLabelList(),
+		httpList = [];
+	for (const key in labelList) {
+		const name = key + 'schemeid';
+		if (data[name]) httpList.push({
+			sa_sizecustomizedschemeid: data[name],
+			date: Date.now() + 1,
+			label: labelList[key],
+			value: data[prefix + key] || "",
+			key: prefix + key,
+			name
+		})
+	};
+
+	return new Promise((resolve, reject) => {
+		if (!httpList.length) return resolve([]);
+		Promise.all(httpList.map(v => _Http.basic({
+			"id": "20230707091603",
+			"version": 1,
+			content: v
+		}))).then(res => resolve(res.map((v, i) => {
+			v.data = Object.assign(v.data, httpList[i])
+			return v
+		}).filter(v => v.msg == '成功').map(v => v.data)))
+	})
+}
+
+function getCustomText(data, prefix = '') {
+	let labelList = getLabelList(),
+		customText = [];
+	for (const key in labelList) {
+		const name = key + 'schemeid';
+		if (data[name]) customText.push(`${labelList[key]}:${data[prefix+key]||'定制'}`)
+	};
+	return customText
+}
+
+module.exports = {
+	getLabelList,
+	getCustomItems,
+	getCustomText
+}

Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików