瀏覽代碼

Merge branch '新功能开发/商品收藏&活动显示' into bug修复/产品详情补丁合并收藏夹分支和定制项分支修复未选中全部选项可以加入购物车的问题

xiaohaizhao 1 年之前
父節點
當前提交
85612d3bd7

+ 2 - 1
app.json

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

+ 344 - 0
packageA/favorites/index.js

@@ -0,0 +1,344 @@
+const _Http = getApp().globalData.http,
+  currency = require("../../utils/currency"),
+  CNY = sum => currency(sum, {
+    symbol: "¥",
+    precision: 2
+  }).format();
+let downCount = {};
+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 => {
+      return new Promise((resolve) => {
+        _Http.basic({
+          "id": 20231121143403,
+          "content": {
+            "itemid": item.itemid,
+            "sa_favoritesid": item.sa_favoritesid,
+            "favoritesqty": item.favoritesqty,
+            "qty": item.favoritesqty,
+            "width": item.width || 0,
+            "length": item.length || 0,
+            "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)
+          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, //必选
+        "items": data.list.map(v => {
+          return {
+            "sa_orderitemsid": 0,
+            "itemid": v.itemid,
+            "qty": v.favoritesqty,
+            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;
+    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" />
+<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.favoriteslength}} / 宽:{{item.favoriteswidth}}
+						<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" />

+ 54 - 9
packageA/market/detail.js

@@ -10,6 +10,7 @@ Page({
 	data: {
 		hidePrice: wx.getStorageSync('hidePrice'),
 		badge: getApp().globalData.collectCount,
+		favoriteCount: getApp().globalData.favoriteCount,
 		loading: true,
 		content: {
 			sa_itemgroupid: null,
@@ -209,13 +210,6 @@ Page({
 			content
 		})
 	},
-	clickBut() {
-		this.data.detail.tradefield.length >= 2 ? wx.showToast({
-			title: '请选择加入产品领域',
-			icon: "none",
-			duration: 3000
-		}) : this.handleStorage(0);
-	},
 	/* 打开文档 */
 	openDocument(e) {
 		const {
@@ -258,11 +252,19 @@ 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) {
@@ -297,6 +299,49 @@ Page({
 			}))
 		})
 	},
+	/* 加入收藏夹 */
+	addToFavorites() {
+		let detail = this.data.detail,
+			content = this.data.content,
+			iscollection = this.data.detail.iscollection == 1 ? false : true
+
+		if (iscollection && 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"
+			})
+		}
+		_Http.basic({
+			"id": 20231121143403,
+			"content": {
+				"itemid": this.data.detail.itemid, //货品id
+				"qty": detail.orderminqty, //数量
+				width: content.dwidth || 0,
+				length: content.dlength || 0,
+				iscollection
+			},
+		}).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({

+ 15 - 0
packageA/market/detail.scss

@@ -123,6 +123,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 +155,8 @@ swiper {
     .active {
       background: #E7EEFF;
     }
+
+
   }
 
   .product-box:last-child {

+ 18 - 3
packageA/market/detail.wxml

@@ -70,7 +70,15 @@
         </view>
     </block>
 
-
+    <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>
 
     <!-- 定制项 -->
     <view wx:if="{{detail.iscustomsize==1}}" style="padding-bottom: 20rpx;">
@@ -145,9 +153,16 @@
         </view>
         购物车
     </navigator>
+    <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>
+    <view class="bg-blue submit" id='addToFavorites' bindtap="clickBut">{{detail.iscollection?'取消收藏商品':'加入收藏夹'}}</view>
     <picker wx:if="{{detail.tradefield.length>=2}}" range='{{detail.tradefield}}' range-key='tradefield' bindchange='storage'>
-        <view class="bg-orange submit" bindtap="clickBut">加入购物车</view>
+        <view class="bg-orange submit" id='addToShoppingCart' bindtap="clickBut">加入购物车</view>
     </picker>
-    <view wx:else class="bg-orange submit" bindtap="clickBut">加入购物车</view>
+    <view wx:else class="bg-orange submit" id='addToShoppingCart' bindtap="clickBut">加入购物车</view>
 </view>
 <wxs src="/utils/hidePrice.wxs" module="handleHide" />

+ 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;

+ 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";
 }

File diff suppressed because it is too large
+ 0 - 0
static/work.wxss


Some files were not shown because too many files changed in this diff