xiaohaizhao 2 years ago
parent
commit
9db9dc4a8f

+ 3 - 4
packageA/market/detail.js

@@ -1,5 +1,5 @@
 const _Http = getApp().globalData.http;
-
+let sa_brandid = null;
 import {
 	fileList
 } from "../../utils/FormatTheAttachment";
@@ -13,6 +13,7 @@ Page({
 			sa_itemgroupid: options.id,
 			itemno: options.itemno
 		})
+		sa_brandid = options.sa_brandid;
 		this.setData({
 			userrole: wx.getStorageSync('userrole')
 		})
@@ -158,8 +159,6 @@ Page({
 				})
 			}
 		})
-
-
 	},
 	/* 选择领域 */
 	storage(e) {
@@ -170,7 +169,7 @@ Page({
 		_Http.basic({
 			"id": 20220924095102,
 			"content": {
-				"sa_brandid": detail.brand, //品牌id
+				sa_brandid,
 				"itemid": detail.itemid, //货品id
 				"qty": detail.orderminqty, //数量
 				"itemno": this.data.itemno, //货品编号

+ 2 - 1
packageA/market/detail.scss

@@ -4,7 +4,7 @@
 swiper {
   width: 100vw;
   height: 464rpx;
-
+  background-color: #fff;
   swiper-item {
     width: 100%;
     height: 100%;
@@ -154,6 +154,7 @@ swiper {
   min-height: 130rpx;
   background-color: #fff;
   box-shadow: rgba(0, 0, 0, 0.15) 0px 5rpx 15rpx 0px;
+  z-index: 999999999999999;
 
   .but {
     width: 690rpx;

+ 1 - 1
packageA/market/detail.wxml

@@ -4,7 +4,7 @@
 <!-- 轮播图 -->
 <swiper indicator-dots circular indicator-active-color='#333'>
   <swiper-item wx:for="{{files.images}}" wx:key="attachmentid" data-index="{{index}}" data-type='image' bindtap="viewMedias">
-    <van-image width="100vw" height="464rpx" fit="cover" src="{{item.cover}}" use-loading-slot use-error-slot lazy-load>
+    <van-image width="100vw" height="464rpx" fit="contain" src="{{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>

+ 233 - 233
packageA/market/index.js

@@ -1,238 +1,238 @@
 const _Http = getApp().globalData.http;
 
 Page({
-    data: {
-        istool: 0, //0商品 1工具
-        brand: {}, //当前品牌
-        brandList: [], //品牌列表
-        typeList: [],
-        cType: {},
-        loading: true,
-        "content": {
-            "pageNumber": 1,
-            "pageTotal": 1,
-            "where": {
-                "condition": ""
-            },
-            sort: []
-        },
-        filter: [{
-            label: "标准",
-            index: null,
-            showName: "value", //显示字段
-            valueKey: "name", //返回Key
-            selectKey: "value", //传参 代表选着字段 不传参返回整个选择对象
-            value: "", //选中值
-            list: []
-        }]
-    },
-    onLoad(options) {
-        this.setData({
-            istool: options.istool ? 1 : 0,
-            userrole: wx.getStorageSync('userrole')
-        })
-        this.getBrand()
-        this.getNum();
-        this.getTradefie();
-        this.getOptionTypeSelect();
-    },
-    /* 获取系统分类 */
-    getOptionTypeSelect() {
-        _Http.basic({
-            "classname": "sysmanage.develop.optiontype.optiontype",
-            "method": "optiontypeselect",
-            "content": {
-                "pageNumber": 1,
-                "pageSize": 999,
-                "typename": "itemstandards",
-                "parameter": {
-                    "siteid": wx.getStorageSync('userMsg').siteid
-                }
-            }
-        }, false).then(res => {
-            console.log("系统标准列表", res)
-            if (res.msg == '成功') this.setData({
-                "filter[0].list": res.data
-            })
-        })
-    },
-    /* 处理筛选 */
-    handleFilter({
-        detail
-    }) {
-        console.log(detail)
-    },
-    /* 获取领域 */
-    getTradefie() {
-        _Http.basic({
-            "id": 20221223141802,
-            "content": {
-                "pageNumber": 1,
-                "pageSize": 9999,
-                "where": {
-                    "condition": ""
-                }
-            }
-        }, false).then(res => {
-            console.log("获取领域", res)
-            if (res.msg != '成功') {
-                res.data = [{
-                    rowindex: 0,
-                    subvalues: [],
-                    sys_enterprise_tradefieldid: 0,
-                    tradefield: "全部"
-                }]
-            } else {
-                res.data.unshift({
-                    rowindex: 0,
-                    subvalues: [],
-                    sys_enterprise_tradefieldid: 0,
-                    tradefield: "全部"
-                })
-            }
-            this.setData({
-                tradefieid: "",
-                tradefieList: res.data
-            });
-        })
-    },
-    /* 切换领域 */
-    tradefieChange(e) {
-        this.setData({
-            tradefieid: e.detail.item.tradefield == '全部' ? "" : e.detail.item.tradefield
-        })
-        this.getList(true);
-    },
-    /* 切换分类 */
-    typeChange({
-        detail
-    }) {
-        let typeList = this.data.typeList;
-        if (typeList.length - 1 != detail.rowIndex) typeList = typeList.slice(0, detail.rowIndex + 1);
-        typeList[detail.rowIndex].active = detail.index
-        if (detail.item.subdep.length) typeList.push({
-            active: -1,
-            list: detail.item.subdep
-        })
-        this.setData({
-            cType: detail.item,
-            typeList
-        });
-        this.getList(true);
-    },
-    /* 获取品牌 */
-    getBrand() {
-        _Http.basic({
-            "id": 20220924163702,
-            "content": {
-                "pageSize": 999,
-            }
-        }).then(res => {
-            console.log("查询品牌", res)
-            if (res.data.length) this.setData({
-                brandList: res.data,
-            });
-            this.data.brand = res.data[0];
-            this.getTypeList();
-        })
-    },
-    /* 切换品牌 */
-    brandChange(e) {
-        this.data.brand = e.detail.item;
-        this.getTypeList();
-    },
-    /* 获取分类 */
-    getTypeList() {
-        _Http.basic({
-            "id": "20220922110403",
-            "pageSize": 1000,
-            "content": {
-                "sa_brandid": this.data.brand.sa_brandid,
-                where: {
-                    "istool": 0, //默认0,不是工具,1表示工具
-                }
-            }
-        }).then(res => {
-            console.log("营销类别", res)
+	data: {
+		istool: 0, //0商品 1工具
+		brand: {}, //当前品牌
+		brandList: [], //品牌列表
+		typeList: [],
+		cType: {},
+		loading: true,
+		"content": {
+			"pageNumber": 1,
+			"pageTotal": 1,
+			"where": {
+				"condition": ""
+			},
+			sort: []
+		},
+		filter: [{
+			label: "标准",
+			index: null,
+			showName: "value", //显示字段
+			valueKey: "name", //返回Key
+			selectKey: "value", //传参 代表选着字段 不传参返回整个选择对象
+			value: "", //选中值
+			list: []
+		}]
+	},
+	onLoad(options) {
+		this.setData({
+			istool: options.istool ? 1 : 0,
+			userrole: wx.getStorageSync('userrole')
+		})
+		this.getBrand()
+		this.getNum();
+		this.getTradefie();
+		this.getOptionTypeSelect();
+	},
+	/* 获取系统分类 */
+	getOptionTypeSelect() {
+		_Http.basic({
+			"classname": "sysmanage.develop.optiontype.optiontype",
+			"method": "optiontypeselect",
+			"content": {
+				"pageNumber": 1,
+				"pageSize": 999,
+				"typename": "itemstandards",
+				"parameter": {
+					"siteid": wx.getStorageSync('userMsg').siteid
+				}
+			}
+		}, false).then(res => {
+			console.log("系统标准列表", res)
+			if (res.msg == '成功') this.setData({
+				"filter[0].list": res.data
+			})
+		})
+	},
+	/* 处理筛选 */
+	handleFilter({
+		detail
+	}) {
+		console.log(detail)
+	},
+	/* 获取领域 */
+	getTradefie() {
+		_Http.basic({
+			"id": 20221223141802,
+			"content": {
+				"pageNumber": 1,
+				"pageSize": 9999,
+				"where": {
+					"condition": ""
+				}
+			}
+		}, false).then(res => {
+			console.log("获取领域", res)
+			if (res.msg != '成功') {
+				res.data = [{
+					rowindex: 0,
+					subvalues: [],
+					sys_enterprise_tradefieldid: 0,
+					tradefield: "全部"
+				}]
+			} else {
+				res.data.unshift({
+					rowindex: 0,
+					subvalues: [],
+					sys_enterprise_tradefieldid: 0,
+					tradefield: "全部"
+				})
+			}
+			this.setData({
+				tradefieid: "",
+				tradefieList: res.data
+			});
+		})
+	},
+	/* 切换领域 */
+	tradefieChange(e) {
+		this.setData({
+			tradefieid: e.detail.item.tradefield == '全部' ? "" : e.detail.item.tradefield
+		})
+		this.getList(true);
+	},
+	/* 切换分类 */
+	typeChange({
+		detail
+	}) {
+		let typeList = this.data.typeList;
+		if (typeList.length - 1 != detail.rowIndex) typeList = typeList.slice(0, detail.rowIndex + 1);
+		typeList[detail.rowIndex].active = detail.index
+		if (detail.item.subdep.length) typeList.push({
+			active: -1,
+			list: detail.item.subdep
+		})
+		this.setData({
+			cType: detail.item,
+			typeList
+		});
+		this.getList(true);
+	},
+	/* 获取品牌 */
+	getBrand() {
+		_Http.basic({
+			"id": 20220924163702,
+			"content": {
+				"pageSize": 999,
+			}
+		}).then(res => {
+			console.log("查询品牌", res)
+			if (res.data.length) this.setData({
+				brandList: res.data,
+			});
+			this.data.brand = res.data[0];
+			this.getTypeList();
+		})
+	},
+	/* 切换品牌 */
+	brandChange(e) {
+		this.data.brand = e.detail.item;
+		this.getTypeList();
+	},
+	/* 获取分类 */
+	getTypeList() {
+		_Http.basic({
+			"id": "20220922110403",
+			"pageSize": 1000,
+			"content": {
+				"sa_brandid": this.data.brand.sa_brandid,
+				where: {
+					"istool": 0, //默认0,不是工具,1表示工具
+				}
+			}
+		}).then(res => {
+			console.log("营销类别", res)
 
-            if (res.data[0].ttemclass) {
-                res.data[0].ttemclass.unshift({
-                    itemclassid: "",
-                    itemclassfullname: "全部",
-                    itemclassname: "全部",
-                    subdep: []
-                })
-                this.setData({
-                    ['typeList[0]']: {
-                        active: 0,
-                        list: res.data[0].ttemclass
-                    },
-                    "cType": res.data[0].ttemclass[0],
-                    loading: false
-                });
-            }
-            this.getList(true);
-        })
-    },
-    /* 获取产品 */
-    getList(init = false) {
-        if (init.detail != undefined) init = init.detail;
-        let content = this.data.content;
-        if (init) content.pageNumber = 1;
-        if (content.pageNumber > content.pageTotal) return;
-        content.brandids = [this.data.brand.sa_brandid];
-        content.where.itemclassid = this.data.cType.itemclassid;
-        content.where.tradefield = this.data.tradefieid;
-        _Http.basic({
-            "id": 20220926142203,
-            content
-        }).then(res => {
-            console.log("商品列表", res)
-            this.selectComponent('#ListBox').RefreshToComplete();
-            this.setData({
-                list: res.data,
-                "content.pageNumber": res.pageNumber + 1,
-                "content.pageTotal": res.pageTotal,
-                "content.sort": res.sort,
-                loading: false
-            })
-            this.setListHeight()
-        })
-    },
-    startFiltration() {
-        /* _Http.basic().then(res => {
-        	console.log("获取领域", res)
-        }) */
-    },
-    /* 搜索 */
-    onSearch({
-        detail
-    }) {
-        this.setData({
-            "content.where.condition": detail
-        });
-        this.getList(true)
-    },
-    onReady() {
-        this.setListHeight()
-    },
-    /* 设置页面高度 */
-    setListHeight() {
-        this.selectComponent("#ListBox").setHeight(".division", this);
-    },
-    /* 获取购物车数量 */
-    getNum() {
-        if (this.data.userrole == '业务员') return;
-        _Http.basic({
-            "id": 20220927093202,
-            "content": {}
-        }).then(res => {
-            console.log("购物车数量", res)
-            getApp().globalData.num = res.data.num;
-            this.selectComponent("#Float").setNum(res.data.num)
-        });
-    },
-    onShow() {
-        if (getApp().globalData.num && this.data.userrole != '业务员') this.selectComponent("#Float").setNum(getApp().globalData.num)
-    }
+			if (res.data[0].ttemclass) {
+				res.data[0].ttemclass.unshift({
+					itemclassid: "",
+					itemclassfullname: "全部",
+					itemclassname: "全部",
+					subdep: []
+				})
+				this.setData({
+					['typeList[0]']: {
+						active: 0,
+						list: res.data[0].ttemclass
+					},
+					"cType": res.data[0].ttemclass[0],
+					loading: false
+				});
+			}
+			this.getList(true);
+		})
+	},
+	/* 获取产品 */
+	getList(init = false) {
+		if (init.detail != undefined) init = init.detail;
+		let content = this.data.content;
+		if (init) content.pageNumber = 1;
+		if (content.pageNumber > content.pageTotal) return;
+		content.brandids = [this.data.brand.sa_brandid];
+		content.where.itemclassid = this.data.cType.itemclassid;
+		content.where.tradefield = this.data.tradefieid;
+		_Http.basic({
+			"id": 20220926142203,
+			content
+		}).then(res => {
+			console.log("商品列表", res)
+			this.selectComponent('#ListBox').RefreshToComplete();
+			this.setData({
+				list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
+				"content.pageNumber": res.pageNumber + 1,
+				"content.pageTotal": res.pageTotal,
+				"content.sort": res.sort,
+				loading: false
+			})
+			this.setListHeight()
+		})
+	},
+	startFiltration() {
+		/* _Http.basic().then(res => {
+			console.log("获取领域", res)
+		}) */
+	},
+	/* 搜索 */
+	onSearch({
+		detail
+	}) {
+		this.setData({
+			"content.where.condition": detail
+		});
+		this.getList(true)
+	},
+	onReady() {
+		this.setListHeight()
+	},
+	/* 设置页面高度 */
+	setListHeight() {
+		this.selectComponent("#ListBox").setHeight(".division", this);
+	},
+	/* 获取购物车数量 */
+	getNum() {
+		if (this.data.userrole == '业务员') return;
+		_Http.basic({
+			"id": 20220927093202,
+			"content": {}
+		}).then(res => {
+			console.log("购物车数量", res)
+			getApp().globalData.num = res.data.num;
+			this.selectComponent("#Float").setNum(res.data.num)
+		});
+	},
+	onShow() {
+		if (getApp().globalData.num && this.data.userrole != '业务员') this.selectComponent("#Float").setNum(getApp().globalData.num)
+	}
 })

+ 6 - 3
packageA/market/modules/list/index.wxml

@@ -1,10 +1,13 @@
-<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}}&sa_brandid={{item.sa_brandid}}" 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-image width="100%" wx:if="{{item.attinfos[0]||item.cover}}" 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>
+		<van-image wx:else width="100%" height="100%" fit="cover" src="https://nb32663.obs.cn-east-2.myhuaweicloud.com:443/202302271677472008916B382a8d8b.jpg" use-loading-slot use-error-slot lazy-load>
 			<van-loading slot="loading" type="spinner" size="20" vertical />
 			<text slot="error">加载失败</text>
 		</van-image>
-		<text class="text" wx:else>暂无图片</text>
 	</view>
 	<view class="right-box">
 		<view class="title line-1">{{item.groupname||'--'}}</view>