Jelajahi Sumber

工具查询/工具购物车

zhaoxiaohai 3 tahun lalu
induk
melakukan
6e18dd1b21

+ 7 - 1
packageA/market/index.js

@@ -2,6 +2,7 @@ const _Http = getApp().globalData.http;
 
 Page({
 	data: {
+		istool: 0, //0商品 1工具
 		brand: {}, //当前品牌
 		brandList: [], //品牌列表
 		typeList: [],
@@ -27,6 +28,9 @@ Page({
 		}]
 	},
 	onLoad(options) {
+		if (options.istool) this.setData({
+			istool: options.istool
+		})
 		this.getBrand()
 		this.getNum();
 		this.getOptionTypeSelect();
@@ -52,7 +56,9 @@ Page({
 		})
 	},
 	/* 处理筛选 */
-	handleFilter({detail}){
+	handleFilter({
+		detail
+	}) {
 		console.log(detail)
 	},
 	/* 切换分类 */

+ 1 - 1
packageA/market/index.wxml

@@ -16,4 +16,4 @@
 <Yl_Filtrate id='Filtrate' list="{{filter}}" bind:handle="handleFilter" dateRange='{{false}}' />
 
 <!-- 购物车按钮 -->
-<Float id="Float" />
+<Float id="Float" pageType="{{istool==0?'Standard':'Tool'}}" />

+ 12 - 202
packageA/shopping/index.js

@@ -1,212 +1,22 @@
-const _Http = getApp().globalData.http;
-let downCount = {};
 Page({
     data: {
-        loading: true,
-        list: [],
-        results: [], //选中结果
-        sa_brandid: null, //当前选中品牌id
-        sum: 0, //价格合
-        yfsum: 0, //运费合
-        classList: [], //生成订单时所选
+        loading: false,
+        tabActive: "Standard"
     },
     onLoad(options) {
-        this.getList()
-    },
-    clickBut(e) {
-        this.data.classList.length >= 2 ? wx.showToast({
-            title: '请选择订单领域(订单只允许同品牌/同领域的商品)',
-            icon: "none",
-            duration: 3000
-        }) : this.handleSubmit(0);
-    },
-    /* 提交 */
-    submit(e) {
-        this.handleSubmit(e.detail.value)
-    },
-    handleSubmit(index) {
-        let data = this.data.classList[index];
-        _Http.basic({
-            "id": 20221128183202,
-            "content": {
-                "tradefield": data.type, //必选
-                "items": data.list.map(v => {
-                    return {
-                        "sa_orderitemsid": 0,
-                        "itemid": v.itemid,
-                        "sa_brandid": v.sa_brandid,
-                        "qty": v.qty
-                    }
-                })
-            }
-        }).then(res => {
-            console.log("转化订单", res)
-            if (res.msg != '成功') return wx.showToast({
-                title: 'res.msg',
-                icon: "none"
-            });
-            wx.showModal({
-                title: '提示',
-                content: '生成成功!是否立即前往',
-                complete: (s) => {
-                    if (s.confirm) {
-                        wx.navigateTo({
-                            url: '/packageA/orderForm/detail?id=' + res.data.sa_orderid,
-                        })
-                    }
-                }
-            });
-            this.getList();
-        })
-    },
-    /* 获取列表 */
-    getList() {
-        _Http.basic({
-            "id": 20220924095302,
-            "content": {
-                nocache: true,
-                "pageNumber": 1,
-                "pageSize": getApp().globalData.num + 5,
-                "where": {
-                    "condition": ""
-                }
-            }
-        }).then(res => {
-            console.log('购物车列表', res)
-            if (res.msg != '成功') return wx.showToast({
-                title: res.msg,
-                icon: "none"
-            })
-            this.setData({
-                list: res.data,
-                loading: false
-            });
-            if (wx.getStorageSync('shopping')) {
-                this.setData({
-                    ...wx.getStorageSync('shopping')
-                });
-                this.computeSum();
-            }
+        if (options.type) this.setData({
+            tabActive: options.type
         })
+        this.getList()
     },
-    /* 切换选中项 */
-    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_shoppingcartid);
-            sa_brandid = item.sa_brandid;
-        } else {
-            let index = results.findIndex(v => v == item.sa_shoppingcartid)
-            if (index == -1) {
-                results.push(item.sa_shoppingcartid);
-            } else {
-                results.splice(index, 1);
-                if (results.length == 0) sa_brandid = null;
-            }
-        };
+    tabChange(e) {
         this.setData({
-            results,
-            sa_brandid
-        })
-        this.computeSum();
-    },
-    /* 计算总价/产品领域分类 */
-    computeSum() {
-        let results = this.data.results,
-            sum = 0,
-            yfsum = 0,
-            deteleList = [],
-            classList = [];
-        if (results.length) results.forEach((v, i) => {
-            let item = this.data.list.find(va => va.sa_shoppingcartid == v);
-            if (item) {
-                sum += (item.qty * item.gradeprice).toFixed(2) - 0;
-                /* 领域分类 */
-                let index = classList.findIndex(value => value.type == item.tradefield_shoppingcart);
-                if (index == -1) {
-                    classList.push({
-                        type: item.tradefield_shoppingcart,
-                        list: [item],
-                        name: item.tradefield_shoppingcart + "(1件商品)"
-                    })
-                } else {
-                    classList[index].list.push(item)
-                    classList[index].name = classList[index].type + `(${classList[index].list.length}件商品)`
-                }
-            } else {
-                deteleList.push(i)
-            }
+            tabActive: e.detail.name
         });
-        if (deteleList.length) {
-            deteleList.forEach(v => {
-                results.splice(v, 1);
-            });
-            getApp().globalData.num = getApp().globalData.num - deteleList.length;
-        };
-        let sa_brandid = results.length ? this.data.sa_brandid : null;
-        wx.setStorageSync('shopping', {
-            results,
-            sa_brandid
-        })
-        this.setData({
-            sum,
-            yfsum,
-            results,
-            sa_brandid,
-            classList
-        })
-    },
-    /* 删除产品 */
-    deteleItem(e) {
-        const {
-            item
-        } = e.currentTarget.dataset;
-        _Http.basic({
-            "id": 20220924095202,
-            "content": {
-                "sa_shoppingcartids": [item.sa_shoppingcartid]
-            }
-        }).then(res => {
-            if (res.msg != '成功') return wx.showToast({
-                title: res.msg,
-                icon: "none"
-            });
-            this.setData({
-                list: this.data.list.filter(v => v.sa_shoppingcartid != item.sa_shoppingcartid)
-            })
-            if (this.data.results.some(v => v == item.sa_shoppingcartid)) this.changeResults({
-                item
-            }, true);
-            getApp().globalData.num = getApp().globalData.num - 1;
-        })
-    },
-    /* 步进器调整 */
-    stepperChange(e) {
-        const {
-            index
-        } = e.currentTarget.dataset;
-        let item = this.data.list[index];
-        item.qty = e.detail;
-        this.setData({
-            [`list[${index}]`]: item
-        })
-        this.computeSum();
-        clearTimeout(downCount['count' + index])
-        downCount['count' + index] = setTimeout(() => {
-            _Http.basic({
-                "id": 20220924104302,
-                "content": {
-                    "sa_shoppingcartid": item.sa_shoppingcartid,
-                    "qty": item.qty
-                },
-            }, false).then(res => {
-                console.log("修改数量", res)
-            })
-        }, 2000)
+        this.getList();
     },
+    getList() {
+        let page = this.selectComponent("#" + this.data.tabActive);
+        page.data.isGet || page.getList();
+    }
 })

+ 2 - 2
packageA/shopping/index.json

@@ -1,6 +1,6 @@
 {
     "usingComponents": {
-        "van-checkbox": "@vant/weapp/checkbox/index",
-        "van-stepper": "@vant/weapp/stepper/index"
+        "Standard": "./modules/standard/index",
+        "Tool": "./modules/tool/index"
     }
 }

+ 0 - 147
packageA/shopping/index.scss

@@ -1,148 +1 @@
 @import "./index.skeleton.wxss";
-
-.item-box {
-    position: relative;
-    width: 100vw;
-    background-color: #fff;
-    margin-bottom: 20rpx;
-    padding-bottom: 20rpx;
-    box-sizing: border-box;
-
-    .top {
-        display: flex;
-        padding: 20rpx 30rpx 10rpx;
-        box-sizing: border-box;
-
-
-        .image {
-            width: 128rpx;
-            height: 128rpx;
-            border-radius: 16rpx;
-            overflow: hidden;
-            margin-right: 20rpx;
-            flex-shrink: 0;
-        }
-
-        .content {
-            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;
-            }
-
-        }
-
-    }
-
-    .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;
-
-            .label-class {
-                font-size: 24rpx;
-                font-family: PingFang SC-Regular, PingFang SC;
-                color: #999999;
-                margin-left: -6rpx;
-            }
-        }
-
-        .input-class {
-            width: 120rpx;
-        }
-    }
-}
-
-.footer {
-    width: 100vw;
-    min-height: 130rpx;
-    position: fixed;
-    bottom: 0;
-    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;
-
-        .sum {
-            height: 40rpx;
-            line-height: 40rpx;
-            font-size: 28rpx;
-            font-family: PingFang SC-Medium, PingFang SC;
-            font-weight: 500;
-            margin-top: 14rpx;
-
-            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: 230rpx;
-        height: 90rpx;
-        background: #3874F6;
-        border-radius: 16rpx;
-        font-size: 28rpx;
-        font-weight: 600;
-        color: #FFFFFF;
-        margin-top: 10rpx;
-    }
-}

+ 8 - 59
packageA/shopping/index.wxml

@@ -1,61 +1,10 @@
 <import src="index.skeleton.wxml" />
 <template is="skeleton" wx:if="{{loading}}" />
-
-<navigator url="#" wx:for="{{list}}" wx:key="item.itemid" class="item-box">
-    <view class="top" bindtap="changeResults" data-item="{{item}}">
-        <view class="image">
-            <van-image width="100%" height="100%" fit="cover" src="{{item.attinfos[0].subfiles[0].url}}" 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>
-                <text class="iconfont icon-guanlian-shanchu" catchtap="deteleItem" data-item="{{item}}" />
-            </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"><text style="font-size: 24rpx;font-weight: 600;color: #FF3B30;">¥{{item.gradeprice}}</text>/<text style="font-size: 20rpx;">¥{{item.oldprice}}</text></view>
-        </view>
-    </view>
-    <view class="bottom">
-        <view class="check" bindtap="changeResults" data-item="{{item}}">
-            <van-checkbox shape='square' disabled="{{sa_brandid && sa_brandid!=item.sa_brandid}}" icon-size='24rpx' label-class='label-class' value="{{ decide.checked(item.sa_shoppingcartid,results) }}" bind:change="onChange">
-                选中
-            </van-checkbox>
-        </view>
-        <van-stepper value="{{ item.qty }}" input-class='input-class' data-index="{{index}}" catch:change="stepperChange" />
-    </view>
-</navigator>
-<Yl_Empty wx:if="{{list.length === 0}}" />
-
-<!-- 底部 -->
-<view style="height: 130rpx;" />
-<view class="footer">
-    <view class="left">
-        <view class="sum">
-            商品合计:<text>¥{{sum}}</text>
-        </view>
-        <view class="transport">
-            运费(预估):<text>¥{{yfsum}}</text>
-        </view>
-    </view>
-    <picker wx:if="{{classList.length>=2}}" range='{{classList}}' range-key='name' disabled='{{!results.length}}' bindchange="submit">
-        <van-button custom-class='but' disabled='{{!results.length}}' bind:click="clickBut">生成订单</van-button>
-    </picker>
-    <van-button wx:else custom-class='but' disabled='{{!results.length}}' bind:click="clickBut">生成订单</van-button>
-</view>
-
-<wxs module="decide">
-    module.exports = {
-        checked: function (id, list) {
-            return list.some(function (v) {
-                return v == id
-            });
-        }
-    }
-</wxs>
+<van-tabs color='var(--assist)' active="{{tabActive}}" border='{{true}}' sticky bind:change='tabChange'>
+	<van-tab title="商品" name="Standard">
+		<Standard id='Standard' />
+	</van-tab>
+	<van-tab title="工具" name="Tool">
+		<Tool id="Tool" />
+	</van-tab>
+</van-tabs>

+ 146 - 0
packageA/shopping/modules/base.scss

@@ -0,0 +1,146 @@
+.item-box {
+	position: relative;
+	width: 100vw;
+	background-color: #fff;
+	margin-bottom: 20rpx;
+	padding-bottom: 20rpx;
+	box-sizing: border-box;
+
+	.top {
+		display: flex;
+		padding: 20rpx 30rpx 10rpx;
+		box-sizing: border-box;
+
+
+		.image {
+			width: 128rpx;
+			height: 128rpx;
+			border-radius: 16rpx;
+			overflow: hidden;
+			margin-right: 20rpx;
+			flex-shrink: 0;
+		}
+
+		.content {
+			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;
+			}
+
+		}
+
+	}
+
+	.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;
+
+			.label-class {
+				font-size: 24rpx;
+				font-family: PingFang SC-Regular, PingFang SC;
+				color: #999999;
+				margin-left: -6rpx;
+			}
+		}
+
+		.input-class {
+			width: 120rpx;
+		}
+	}
+}
+
+.footer {
+	width: 100vw;
+	min-height: 130rpx;
+	position: fixed;
+	bottom: 0;
+	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;
+
+		.sum {
+			height: 40rpx;
+			line-height: 40rpx;
+			font-size: 28rpx;
+			font-family: PingFang SC-Medium, PingFang SC;
+			font-weight: 500;
+			margin-top: 14rpx;
+
+			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: 230rpx;
+		height: 90rpx;
+		background: #3874F6;
+		border-radius: 16rpx;
+		font-size: 28rpx;
+		font-weight: 600;
+		color: #FFFFFF;
+		margin-top: 10rpx;
+	}
+}

+ 7 - 1
packageA/shopping/modules/float/index.js

@@ -1,5 +1,11 @@
 const _Http = getApp().globalData.http;
 Component({
+  properties: {
+    pageType: {
+      type: String,
+      value: "Standard"
+    }
+  },
   data: {
     num: 0,
   },
@@ -7,7 +13,7 @@ Component({
     /* 去购物车 */
     toShopping() {
       wx.navigateTo({
-        url: '/packageA/shopping/index',
+        url: '/packageA/shopping/index?type=' + this.data.pageType,
       })
     },
     /* 设置数量 */

+ 217 - 0
packageA/shopping/modules/standard/index.js

@@ -0,0 +1,217 @@
+const _Http = getApp().globalData.http;
+let downCount = {};
+Component({
+  properties: {
+
+  },
+  data: {
+    isGet: false,
+    list: [],
+    results: [], //选中结果
+    sa_brandid: null, //当前选中品牌id
+    classList: [], //生成订单时所选
+    sum: 0, //价格合
+    yfsum: 0, //运费合
+  },
+  methods: {
+    /* 获取列表 */
+    getList() {
+      _Http.basic({
+        "id": 20220924095302,
+        "content": {
+          nocache: true,
+          istool: 0,
+          "pageNumber": 1,
+          "pageSize": getApp().globalData.num + 5,
+          "where": {
+            "condition": ""
+          }
+        }
+      }).then(res => {
+        console.log('购物车列表', res)
+        if (res.msg != '成功') return wx.showToast({
+          title: res.msg,
+          icon: "none"
+        })
+        this.setData({
+          list: res.data,
+          isGet: true
+        });
+
+        if (wx.getStorageSync('shopping')) {
+          this.setData({
+            ...wx.getStorageSync('shopping')
+          });
+          this.computeSum();
+        }
+      })
+    },
+    clickBut(e) {
+      this.data.classList.length >= 2 ? wx.showToast({
+        title: '请选择订单领域(订单只允许同品牌/同领域的商品)',
+        icon: "none",
+        duration: 3000
+      }) : this.handleSubmit(0);
+    },
+    /* 提交 */
+    submit(e) {
+      this.handleSubmit(e.detail.value)
+    },
+    handleSubmit(index) {
+      let data = this.data.classList[index];
+      _Http.basic({
+        "id": 20221128183202,
+        "content": {
+          istool: 0,
+          "tradefield": data.type, //必选
+          "items": data.list.map(v => {
+            return {
+              "sa_orderitemsid": 0,
+              "itemid": v.itemid,
+              "sa_brandid": v.sa_brandid,
+              "qty": v.qty
+            }
+          })
+        }
+      }).then(res => {
+        console.log("转化订单", res)
+        if (res.msg != '成功') return wx.showToast({
+          title: 'res.msg',
+          icon: "none"
+        });
+        wx.showModal({
+          title: '提示',
+          content: '生成成功!是否立即前往',
+          complete: (s) => {
+            if (s.confirm) {
+              wx.navigateTo({
+                url: '/packageA/orderForm/detail?id=' + res.data.sa_orderid,
+              })
+            }
+          }
+        });
+        this.getList();
+      })
+    },
+    /* 切换选中项 */
+    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_shoppingcartid);
+        sa_brandid = item.sa_brandid;
+      } else {
+        let index = results.findIndex(v => v == item.sa_shoppingcartid)
+        if (index == -1) {
+          results.push(item.sa_shoppingcartid);
+        } else {
+          results.splice(index, 1);
+          if (results.length == 0) sa_brandid = null;
+        }
+      };
+      this.setData({
+        results,
+        sa_brandid
+      })
+      this.computeSum();
+    },
+    /* 计算总价/产品领域分类 */
+    computeSum() {
+      let results = this.data.results,
+        sum = 0,
+        yfsum = 0,
+        deteleList = [],
+        classList = [];
+      if (results.length) results.forEach((v, i) => {
+        let item = this.data.list.find(va => va.sa_shoppingcartid == v);
+        if (item) {
+          sum += (item.qty * item.gradeprice).toFixed(2) - 0;
+          /* 领域分类 */
+          let index = classList.findIndex(value => value.type == item.tradefield_shoppingcart);
+          if (index == -1) {
+            classList.push({
+              type: item.tradefield_shoppingcart,
+              list: [item],
+              name: item.tradefield_shoppingcart + "(1件商品)"
+            })
+          } else {
+            classList[index].list.push(item)
+            classList[index].name = classList[index].type + `(${classList[index].list.length}件商品)`
+          }
+        } else {
+          deteleList.push(i)
+        }
+      });
+      if (deteleList.length) {
+        deteleList.forEach(v => {
+          results.splice(v, 1);
+        });
+        getApp().globalData.num = getApp().globalData.num - deteleList.length;
+      };
+      let sa_brandid = results.length ? this.data.sa_brandid : null;
+      wx.setStorageSync('shopping', {
+        results,
+        sa_brandid
+      })
+      this.setData({
+        sum,
+        yfsum,
+        results,
+        sa_brandid,
+        classList
+      })
+    },
+    /* 删除产品 */
+    deteleItem(e) {
+      const {
+        item
+      } = e.currentTarget.dataset;
+      _Http.basic({
+        "id": 20220924095202,
+        "content": {
+          "sa_shoppingcartids": [item.sa_shoppingcartid]
+        }
+      }).then(res => {
+        if (res.msg != '成功') return wx.showToast({
+          title: res.msg,
+          icon: "none"
+        });
+        this.setData({
+          list: this.data.list.filter(v => v.sa_shoppingcartid != item.sa_shoppingcartid)
+        })
+        if (this.data.results.some(v => v == item.sa_shoppingcartid)) this.changeResults({
+          item
+        }, true);
+        getApp().globalData.num = getApp().globalData.num - 1;
+      })
+    },
+    /* 步进器调整 */
+    stepperChange(e) {
+      const {
+        index
+      } = e.currentTarget.dataset;
+      let item = this.data.list[index];
+      item.qty = e.detail;
+      this.setData({
+        [`list[${index}]`]: item
+      })
+      this.computeSum();
+      clearTimeout(downCount['count' + index])
+      downCount['count' + index] = setTimeout(() => {
+        _Http.basic({
+          "id": 20220924104302,
+          "content": {
+            "sa_shoppingcartid": item.sa_shoppingcartid,
+            "qty": item.qty
+          },
+        }, false).then(res => {
+          console.log("修改数量", res)
+        })
+      }, 2000)
+    },
+  }
+})

+ 7 - 0
packageA/shopping/modules/standard/index.json

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

+ 1 - 0
packageA/shopping/modules/standard/index.scss

@@ -0,0 +1 @@
+@import "../base.scss";

+ 57 - 0
packageA/shopping/modules/standard/index.wxml

@@ -0,0 +1,57 @@
+
+<navigator url="#" wx:for="{{list}}" wx:key="item.itemid" class="item-box">
+    <view class="top" bindtap="changeResults" data-item="{{item}}">
+        <view class="image">
+            <van-image width="100%" height="100%" fit="cover" src="{{item.attinfos[0].subfiles[0].url}}" 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>
+                <text class="iconfont icon-guanlian-shanchu" catchtap="deteleItem" data-item="{{item}}" />
+            </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"><text style="font-size: 24rpx;font-weight: 600;color: #FF3B30;">¥{{item.gradeprice}}</text>/<text style="font-size: 20rpx;">¥{{item.oldprice}}</text></view>
+        </view>
+    </view>
+    <view class="bottom">
+        <view class="check" bindtap="changeResults" data-item="{{item}}">
+            <van-checkbox shape='square' disabled="{{sa_brandid && sa_brandid!=item.sa_brandid}}" icon-size='24rpx' label-class='label-class' value="{{ decide.checked(item.sa_shoppingcartid,results) }}" bind:change="onChange">
+                选中
+            </van-checkbox>
+        </view>
+        <van-stepper value="{{ item.qty }}" input-class='input-class' data-index="{{index}}" catch:change="stepperChange" />
+    </view>
+</navigator>
+<Yl_Empty wx:if="{{list.length === 0}}" />
+<!-- 底部 -->
+<view style="height: 130rpx;" />
+<view class="footer">
+    <view class="left">
+        <view class="sum">
+            商品合计:<text>¥{{sum}}</text>
+        </view>
+        <view class="transport">
+            运费(预估):<text>¥{{yfsum}}</text>
+        </view>
+    </view>
+    <picker wx:if="{{classList.length>=2}}" range='{{classList}}' range-key='name' disabled='{{!results.length}}' bindchange="submit">
+        <van-button custom-class='but' disabled='{{!results.length}}' bind:click="clickBut">生成订单</van-button>
+    </picker>
+    <van-button wx:else custom-class='but' disabled='{{!results.length}}' bind:click="clickBut">生成订单</van-button>
+</view>
+<wxs module="decide">
+    module.exports = {
+        checked: function (id, list) {
+            return list.some(function (v) {
+                return v == id
+            });
+        }
+    }
+</wxs>

+ 217 - 0
packageA/shopping/modules/tool/index.js

@@ -0,0 +1,217 @@
+const _Http = getApp().globalData.http;
+let downCount = {};
+Component({
+  properties: {
+
+  },
+  data: {
+    isGet: false,
+    list: [],
+    results: [], //选中结果
+    sa_brandid: null, //当前选中品牌id
+    classList: [], //生成订单时所选
+    sum: 0, //价格合
+    yfsum: 0, //运费合
+  },
+  methods: {
+    /* 获取列表 */
+    getList() {
+      _Http.basic({
+        "id": 20220924095302,
+        "content": {
+          nocache: true,
+          "istool": 1,
+          "pageNumber": 1,
+          "pageSize": getApp().globalData.num + 5,
+          "where": {
+            "condition": ""
+          }
+        }
+      }).then(res => {
+        console.log('购物车列表', res)
+        if (res.msg != '成功') return wx.showToast({
+          title: res.msg,
+          icon: "none"
+        })
+        this.setData({
+          list: res.data,
+          isGet: true
+        });
+
+        if (wx.getStorageSync('shopping_tool')) {
+          this.setData({
+            ...wx.getStorageSync('shopping_tool')
+          });
+          this.computeSum();
+        }
+      })
+    },
+    clickBut(e) {
+      this.data.classList.length >= 2 ? wx.showToast({
+        title: '请选择订单领域(订单只允许同品牌/同领域的商品)',
+        icon: "none",
+        duration: 3000
+      }) : this.handleSubmit(0);
+    },
+    /* 提交 */
+    submit(e) {
+      this.handleSubmit(e.detail.value)
+    },
+    handleSubmit(index) {
+      let data = this.data.classList[index];
+      _Http.basic({
+        "id": 20221128183202,
+        "content": {
+          "istool": 1,
+          "tradefield": data.type, //必选
+          "items": data.list.map(v => {
+            return {
+              "sa_orderitemsid": 0,
+              "itemid": v.itemid,
+              "sa_brandid": v.sa_brandid,
+              "qty": v.qty
+            }
+          })
+        }
+      }).then(res => {
+        console.log("转化订单", res)
+        if (res.msg != '成功') return wx.showToast({
+          title: 'res.msg',
+          icon: "none"
+        });
+        wx.showModal({
+          title: '提示',
+          content: '生成成功!是否立即前往',
+          complete: (s) => {
+            if (s.confirm) {
+              wx.navigateTo({
+                url: '/packageA/orderForm/detail?id=' + res.data.sa_orderid,
+              })
+            }
+          }
+        });
+        this.getList();
+      })
+    },
+    /* 切换选中项 */
+    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_shoppingcartid);
+        sa_brandid = item.sa_brandid;
+      } else {
+        let index = results.findIndex(v => v == item.sa_shoppingcartid)
+        if (index == -1) {
+          results.push(item.sa_shoppingcartid);
+        } else {
+          results.splice(index, 1);
+          if (results.length == 0) sa_brandid = null;
+        }
+      };
+      this.setData({
+        results,
+        sa_brandid
+      })
+      this.computeSum();
+    },
+    /* 计算总价/产品领域分类 */
+    computeSum() {
+      let results = this.data.results,
+        sum = 0,
+        yfsum = 0,
+        deteleList = [],
+        classList = [];
+      if (results.length) results.forEach((v, i) => {
+        let item = this.data.list.find(va => va.sa_shoppingcartid == v);
+        if (item) {
+          sum += (item.qty * item.gradeprice).toFixed(2) - 0;
+          /* 领域分类 */
+          let index = classList.findIndex(value => value.type == item.tradefield_shoppingcart);
+          if (index == -1) {
+            classList.push({
+              type: item.tradefield_shoppingcart,
+              list: [item],
+              name: item.tradefield_shoppingcart + "(1件商品)"
+            })
+          } else {
+            classList[index].list.push(item)
+            classList[index].name = classList[index].type + `(${classList[index].list.length}件商品)`
+          }
+        } else {
+          deteleList.push(i)
+        }
+      });
+      if (deteleList.length) {
+        deteleList.forEach(v => {
+          results.splice(v, 1);
+        });
+        getApp().globalData.num = getApp().globalData.num - deteleList.length;
+      };
+      let sa_brandid = results.length ? this.data.sa_brandid : null;
+      wx.setStorageSync('shopping_tool', {
+        results,
+        sa_brandid
+      })
+      this.setData({
+        sum,
+        yfsum,
+        results,
+        sa_brandid,
+        classList
+      })
+    },
+    /* 删除产品 */
+    deteleItem(e) {
+      const {
+        item
+      } = e.currentTarget.dataset;
+      _Http.basic({
+        "id": 20220924095202,
+        "content": {
+          "sa_shoppingcartids": [item.sa_shoppingcartid]
+        }
+      }).then(res => {
+        if (res.msg != '成功') return wx.showToast({
+          title: res.msg,
+          icon: "none"
+        });
+        this.setData({
+          list: this.data.list.filter(v => v.sa_shoppingcartid != item.sa_shoppingcartid)
+        })
+        if (this.data.results.some(v => v == item.sa_shoppingcartid)) this.changeResults({
+          item
+        }, true);
+        getApp().globalData.num = getApp().globalData.num - 1;
+      })
+    },
+    /* 步进器调整 */
+    stepperChange(e) {
+      const {
+        index
+      } = e.currentTarget.dataset;
+      let item = this.data.list[index];
+      item.qty = e.detail;
+      this.setData({
+        [`list[${index}]`]: item
+      })
+      this.computeSum();
+      clearTimeout(downCount['count' + index])
+      downCount['count' + index] = setTimeout(() => {
+        _Http.basic({
+          "id": 20220924104302,
+          "content": {
+            "sa_shoppingcartid": item.sa_shoppingcartid,
+            "qty": item.qty
+          },
+        }, false).then(res => {
+          console.log("修改数量", res)
+        })
+      }, 2000)
+    },
+  }
+})

+ 7 - 0
packageA/shopping/modules/tool/index.json

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

+ 1 - 0
packageA/shopping/modules/tool/index.scss

@@ -0,0 +1 @@
+@import "../base.scss";

+ 57 - 0
packageA/shopping/modules/tool/index.wxml

@@ -0,0 +1,57 @@
+
+<navigator url="#" wx:for="{{list}}" wx:key="item.itemid" class="item-box">
+    <view class="top" bindtap="changeResults" data-item="{{item}}">
+        <view class="image">
+            <van-image width="100%" height="100%" fit="cover" src="{{item.attinfos[0].subfiles[0].url}}" 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>
+                <text class="iconfont icon-guanlian-shanchu" catchtap="deteleItem" data-item="{{item}}" />
+            </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"><text style="font-size: 24rpx;font-weight: 600;color: #FF3B30;">¥{{item.gradeprice}}</text>/<text style="font-size: 20rpx;">¥{{item.oldprice}}</text></view>
+        </view>
+    </view>
+    <view class="bottom">
+        <view class="check" bindtap="changeResults" data-item="{{item}}">
+            <van-checkbox shape='square' disabled="{{sa_brandid && sa_brandid!=item.sa_brandid}}" icon-size='24rpx' label-class='label-class' value="{{ decide.checked(item.sa_shoppingcartid,results) }}" bind:change="onChange">
+                选中
+            </van-checkbox>
+        </view>
+        <van-stepper value="{{ item.qty }}" input-class='input-class' data-index="{{index}}" catch:change="stepperChange" />
+    </view>
+</navigator>
+<Yl_Empty wx:if="{{list.length === 0}}" />
+<!-- 底部 -->
+<view style="height: 130rpx;" />
+<view class="footer">
+    <view class="left">
+        <view class="sum">
+            工具合计:<text>¥{{sum}}</text>
+        </view>
+        <view class="transport">
+            运费(预估):<text>¥{{yfsum}}</text>
+        </view>
+    </view>
+    <picker wx:if="{{classList.length>=2}}" range='{{classList}}' range-key='name' disabled='{{!results.length}}' bindchange="submit">
+        <van-button custom-class='but' disabled='{{!results.length}}' bind:click="clickBut">生成订单</van-button>
+    </picker>
+    <van-button wx:else custom-class='but' disabled='{{!results.length}}' bind:click="clickBut">生成订单</van-button>
+</view>
+<wxs module="decide">
+    module.exports = {
+        checked: function (id, list) {
+            return list.some(function (v) {
+                return v == id
+            });
+        }
+    }
+</wxs>

+ 22 - 19
packageA/tool/index.js

@@ -19,45 +19,48 @@ Page({
     },
 
     filter: [{
-      label: "标准",
+      label: "领域",
       index: null,
-      showName: "value", //显示字段
-      valueKey: "name", //返回Key
-      selectKey: "value", //传参 代表选着字段 不传参返回整个选择对象
+      showName: "tradefield", //显示字段
+      valueKey: "tradefield", //返回Key
+      selectKey: "tradefield", //传参 代表选着字段 不传参返回整个选择对象
       value: "", //选中值
       list: []
     }]
   },
   onLoad(options) {
     this.getBrand()
-    // this.getNum();
-    this.getOptionTypeSelect();
+    this.getNum();
+    this.getDomain();
   },
-  /* 获取系统分类 */
-  getOptionTypeSelect() {
+  /* 获取领域 */
+  getDomain() {
     _Http.basic({
-      "classname": "sysmanage.develop.optiontype.optiontype",
-      "method": "optiontypeselect",
+      "id": 20221223141802,
       "content": {
         "pageNumber": 1,
-        "pageSize": 999,
-        "typename": "itemstandards",
-        "parameter": {
-          "siteid": wx.getStorageSync('userMsg').siteid
+        "pageSize": 99999,
+        "where": {
+          "condition": ""
         }
       }
-    }, false).then(res => {
-      console.log("系统标准列表", res)
-      if (res.msg == '成功') this.setData({
+    }).then(res => {
+      console.log("获取领域", res)
+      if (res.data.length) this.setData({
         "filter[0].list": res.data
-      })
+      });
     })
   },
   /* 处理筛选 */
   handleFilter({
     detail
   }) {
-    console.log(detail)
+    if (detail.tradefield === {}) detail.tradefield = "";
+    if (detail.tradefield == this.data.content.tradefield) return;
+    this.setData({
+      "content.tradefield": detail.tradefield
+    });
+    this.getList(true);
   },
   /* 切换分类 */
   typeChange({

+ 2 - 1
packageA/tool/index.json

@@ -1,6 +1,7 @@
 {
   "usingComponents": {
     "Tabs": "../market/modules/tabs/index",
-    "List": "./modules/list/index"
+    "List": "./modules/list/index",
+    "Float": "../shopping/modules/float"
   }
 }

+ 1 - 3
packageA/tool/index.wxml

@@ -7,9 +7,7 @@
 <Yl_ListBox id='ListBox' bind:getlist='getList'>
 	<List list="{{list}}" />
 </Yl_ListBox>
-
 <!-- 筛选条件 -->
 <Yl_Filtrate id='Filtrate' list="{{filter}}" bind:handle="handleFilter" dateRange='{{false}}' />
-
 <!-- 购物车按钮 -->
-<Float id="Float" />
+<Float id="Float" pageType='Tool' />

+ 1 - 1
packageA/tool/modules/list/index.wxml

@@ -1,4 +1,4 @@
-<navigator class="product" url="/packageA/market/detail?id={{item.sa_itemgroupid}}&itemno={{item.itemno}}" wx:for="{{list}}" wx:key="index">
+<navigator class="product" url="/packageA/market/detail?id={{item.sa_itemgroupid}}&itemno={{item.itemno}}&istool=1" wx:for="{{list}}" wx:key="index">
 	<view class="image-box">
 		<van-image width="100%" wx:if="{{item.attinfos[0]}}" height="100%" fit="cover" src="{{item.attinfos[0].subfiles[0].url}}" use-loading-slot use-error-slot lazy-load>
 			<van-loading slot="loading" type="spinner" size="20" vertical />

+ 181 - 172
pages/tabbar/home/index.js

@@ -1,175 +1,184 @@
 let _Http = getApp().globalData.http,
-    DataCarousel = null;
+	DataCarousel = null;
 Page({
-    data: {
-        bannerList: [], //banner列表
-        gridList: [],
-        notice: "",
-        msgCount: 1,
-        msgList: [], //消息列表
-    },
-    onLoad(options) {
-        this.setData({ //获取胶囊位置信息
-            capsule: wx.getMenuButtonBoundingClientRect()
-        })
-        this.refreshData() //更新权限等信息
-    },
-    /* 更新站点信息 */
-    refreshData() {
-        this.setData({
-            user: wx.getStorageSync('userMsg')
-        })
-        /* 首页宫格授权查询 */
-        if (wx.getStorageSync('userauth').length != 0) {
-            let auth = getApp().globalData.queryPer.query(wx.getStorageSync('userauth'), ['营销工具'], []),
-                gridList = [],
-                authList = {};
-            wx.setStorageSync('auth', authList)
-            gridList.push({
-                name: "商城",
-                path: "/packageA/market/index",
-                color: "#F29C37",
-                bColor: "#FCF6EF",
-                icon: "icon-shangcheng"
-            })
-            gridList.push({
-                name: "销售订单",
-                path: "/packageA/orderForm/index",
-                color: "#5AB73F",
-                bColor: "#F4FAEF",
-                icon: "icon-dingdan"
-            })
-            gridList.push({
-                name: "收货",
-                path: "/packageA/shipment/index",
-                color: "#3874F6",
-                bColor: "#F0F3FF",
-                icon: "icon-shouhuo"
-            })
-            gridList.push({
-                name: "业绩目标",
-                path: "/packageA/target/index",
-                color: "#5AB73F",
-                bColor: "#F4FAEF",
-                icon: "icon-yejimubiao"
-            })
-            gridList.push({
-                name: "账户",
-                path: "/packageA/account/index",
-                color: "#EB4B5C",
-                bColor: "#FDF1ED",
-                icon: "icon-zhanghu"
-            })
-            /* ------------------------------- */
-
-
-            gridList.push({
-                name: "促销活动",
-                path: "#",
-                color: "#3874F6",
-                bColor: "#F0F3FF",
-                icon: "icon-cuxiaohuodong"
-            })
-            gridList.push({
-                name: "开票",
-                path: "#",
-                color: "#EB4B5C",
-                bColor: "#FDF1ED",
-                icon: "icon-kaipiao"
-            })
-      
-
-            gridList.push({
-                name: "数据查询",
-                path: "#",
-                color: "#F29C37",
-                bColor: "#FCF6EF",
-                icon: "icon-shujuchaxun"
-            })
-
-            /* ------------------------------- */
-            this.setData({
-                gridList
-            })
-        } else {
-            setTimeout(this.refreshData, 10);
-            return;
-        }
-        /* 获取首页banner */
-        let banner = wx.getStorageSync('banner_list').find(v => v.location == "index_top");
-        if (banner) this.setData({
-            bannerList: banner.ads
-        })
-    },
-    /* 获取最新信息 */
-    queryMessage(i = 0) {
-        _Http.basic({
-            "classname": "system.message.Message",
-            "method": "queryMessage",
-            content: {
-                nocache: true,
-                pageNumber: 1,
-                pageSize: 5,
-                pageTotal: 1,
-                type: "",
-                where: {}
-            },
-        }, false).then(res => {
-            if (res.msg != '成功') return (i <= 5) ? this.queryMessage(i + 1) : wx.showToast({
-                title: res.msg,
-                icon: "none"
-            })
-            this.setData({
-                msgList: res.data,
-                notice: res.data[0]
-            })
-            if (this.data.msgList.length > 2) this.startDataCarousel();
-        })
-    },
-    /* 开启消息轮播 */
-    startDataCarousel() {
-        clearInterval(DataCarousel);
-        DataCarousel = setInterval(() => {
-            let count = this.data.msgCount < this.data.msgList.length ? this.data.msgCount : 0;
-            this.setData({
-                msgCount: count + 1,
-                notice: this.data.msgList[count]
-            })
-        }, 5000)
-    },
-    /* 去消息详情 */
-    toMsg(e) {
-        const {
-            item
-        } = e.currentTarget.dataset;
-        wx.navigateTo({
-            url: '/pages/tabbar/message/details?id=' + item.messageid,
-        })
-    },
-    /* banner */
-    bannerClick(e) {
-        const {
-            item
-        } = e.currentTarget.dataset,
-            hyperlink = item.hyperlink.split(":");
-        if (hyperlink[0] == 'path') wx.navigateTo({
-            url: hyperlink[1]
-        })
-    },
-    onShow() {
-        this.getTabBar().init();
-        if (this.data.msgList.length > 2) this.startDataCarousel();
-        this.queryMessage(0); //更新最新消息
-    },
-    onHide() {
-        clearInterval(DataCarousel);
-    },
-    onReady() {
-        this.setListHeight();
-    },
-    /* 设置页面高度 */
-    setListHeight() {
-        this.selectComponent("#ListBox").setHeight(".grld-title", this);
-    },
-    onShareAppMessage() {}
+	data: {
+		bannerList: [], //banner列表
+		gridList: [],
+		notice: "",
+		msgCount: 1,
+		msgList: [], //消息列表
+	},
+	onLoad(options) {
+		this.setData({ //获取胶囊位置信息
+			capsule: wx.getMenuButtonBoundingClientRect()
+		})
+		this.refreshData() //更新权限等信息
+	},
+	/* 更新站点信息 */
+	refreshData() {
+		this.setData({
+			user: wx.getStorageSync('userMsg')
+		})
+		/* 首页宫格授权查询 */
+		if (wx.getStorageSync('userauth').length != 0) {
+			let auth = getApp().globalData.queryPer.query(wx.getStorageSync('userauth'), ['营销工具'], []),
+				gridList = [],
+				authList = {};
+			wx.setStorageSync('auth', authList)
+			gridList.push({
+				name: "商城",
+				path: "/packageA/market/index",
+				color: "#F29C37",
+				bColor: "#FCF6EF",
+				icon: "icon-shangcheng"
+			})
+			gridList.push({
+				name: "销售订单",
+				path: "/packageA/orderForm/index",
+				color: "#5AB73F",
+				bColor: "#F4FAEF",
+				icon: "icon-dingdan"
+			})
+			gridList.push({
+				name: "收货",
+				path: "/packageA/shipment/index",
+				color: "#3874F6",
+				bColor: "#F0F3FF",
+				icon: "icon-shouhuo"
+			})
+			gridList.push({
+				name: "业绩目标",
+				path: "/packageA/target/index",
+				color: "#5AB73F",
+				bColor: "#F4FAEF",
+				icon: "icon-yejimubiao"
+			})
+			gridList.push({
+				name: "账户",
+				path: "/packageA/account/index",
+				color: "#EB4B5C",
+				bColor: "#FDF1ED",
+				icon: "icon-zhanghu"
+			})
+			gridList.push({
+				name: "促销活动",
+				path: "/packageA/activity/index",
+				color: "#3874F6",
+				bColor: "#F0F3FF",
+				icon: "icon-cuxiaohuodong"
+			})
+			gridList.push({
+				name: "工具查询",
+				path: "/packageA/tool/index",
+				color: "#EB4B5C",
+				bColor: "#FDF1ED",
+				icon: "icon-kaipiao"
+			})
+			gridList.push({
+				name: "购物车",
+				path: "/packageA/shopping/index",
+				color: "#EB4B5C",
+				bColor: "#FDF1ED",
+				icon: "icon-kaipiao"
+			})
+			/* ------------------------------- */
+			gridList.push({
+				name: "开票",
+				path: "#",
+				color: "#EB4B5C",
+				bColor: "#FDF1ED",
+				icon: "icon-kaipiao"
+			})
+			gridList.push({
+				name: "数据查询",
+				path: "#",
+				color: "#F29C37",
+				bColor: "#FCF6EF",
+				icon: "icon-shujuchaxun"
+			})
+			/* ------------------------------- */
+			this.setData({
+				gridList
+			})
+		} else {
+			setTimeout(this.refreshData, 10);
+			return;
+		}
+		/* 获取首页banner */
+		let banner = wx.getStorageSync('banner_list').find(v => v.location == "index_top");
+		if (banner) this.setData({
+			bannerList: banner.ads
+		})
+	},
+	/* 获取最新信息 */
+	queryMessage(i = 0) {
+		_Http.basic({
+			"classname": "system.message.Message",
+			"method": "queryMessage",
+			content: {
+				nocache: true,
+				pageNumber: 1,
+				pageSize: 5,
+				pageTotal: 1,
+				type: "",
+				where: {}
+			},
+		}, false).then(res => {
+			if (res.msg != '成功') return (i <= 5) ? this.queryMessage(i + 1) : wx.showToast({
+				title: res.msg,
+				icon: "none"
+			})
+			this.setData({
+				msgList: res.data,
+				notice: res.data[0]
+			})
+			if (this.data.msgList.length > 2) this.startDataCarousel();
+		})
+	},
+	/* 开启消息轮播 */
+	startDataCarousel() {
+		clearInterval(DataCarousel);
+		DataCarousel = setInterval(() => {
+			let count = this.data.msgCount < this.data.msgList.length ? this.data.msgCount : 0;
+			this.setData({
+				msgCount: count + 1,
+				notice: this.data.msgList[count]
+			})
+		}, 5000)
+	},
+	/* 去消息详情 */
+	toMsg(e) {
+		const {
+			item
+		} = e.currentTarget.dataset;
+		wx.navigateTo({
+			url: '/pages/tabbar/message/details?id=' + item.messageid,
+		})
+	},
+	/* banner */
+	bannerClick(e) {
+		const {
+			item
+		} = e.currentTarget.dataset,
+			hyperlink = item.hyperlink.split(":");
+		if (hyperlink[0] == 'path') wx.navigateTo({
+			url: hyperlink[1]
+		})
+	},
+	onShow() {
+		this.getTabBar().init();
+		if (this.data.msgList.length > 2) this.startDataCarousel();
+		this.queryMessage(0); //更新最新消息
+	},
+	onHide() {
+		clearInterval(DataCarousel);
+	},
+	onReady() {
+		this.setListHeight();
+	},
+	/* 设置页面高度 */
+	setListHeight() {
+		this.selectComponent("#ListBox").setHeight(".grld-title", this);
+	},
+	onShareAppMessage() {}
 })