Browse Source

产品清单

zhaoxiaohai 2 years ago
parent
commit
e702ba3cf6

+ 67 - 61
app.json

@@ -1,63 +1,69 @@
 {
-  "pages": [
-    "pages/home/index",
-    "pages/base/index"
-  ],
-  "subpackages": [
-    {
-      "root": "packageA",
-      "pages": [
-        "market/index",
-        "market/detail",
-        "shopping/index",
-        "orderForm/index",
-        "orderForm/detail",
-        "orderForm/add"
-      ]
-    },
-    {
-      "root": "select",
-      "pages": [
-        "product/index"
-      ]
-    }
-  ],
-  "preloadRule": {
-    "pages/home/index": {
-      "packages": [
-        "packageA",
-        "select"
-      ],
-      "network": "all"
-    }
-  },
-  "usingComponents": {
-    "Yl_Empty": "/components/Yl_Empty/index",
-    "Yl_Filtrate": "/components/Yl_Filtrate/index",
-    "Yl_FloatingButton": "/components/Yl_FloatingButton/index",
-    "Yl_FunTabs": "/components/Yl_FunTabs/index",
-    "Yl_HeadNav": "/components/Yl_HeadNav/index",
-    "Yl_ListBox": "/components/Yl_ListBox/index",
-    "Yl_Tabbar": "/components/Yl_Tabbar/index",
-    "Yl_Field": "/components/Yl_Field/index",
-    "van-button": "@vant/weapp/button/index",
-    "van-cell": "@vant/weapp/cell/index",
-    "van-action-sheet": "@vant/weapp/action-sheet/index",
-    "van-popup": "@vant/weapp/popup/index",
-    "van-checkbox": "@vant/weapp/checkbox/index",
-    "van-checkbox-group": "@vant/weapp/checkbox-group/index",
-    "van-image": "@vant/weapp/image/index",
-    "van-loading": "@vant/weapp/loading/index",
-    "van-icon": "@vant/weapp/icon/index",
-    "van-tab": "@vant/weapp/tab/index",
-    "van-tabs": "@vant/weapp/tabs/index",
-    "van-search": "@vant/weapp/search/index"
-  },
-  "window": {
-    "backgroundTextStyle": "light",
-    "navigationBarBackgroundColor": "#085CDF",
-    "navigationBarTitleText": "E-订单",
-    "navigationBarTextStyle": "white"
-  },
-  "sitemapLocation": "sitemap.json"
+	"pages": [
+		"pages/home/index",
+		"pages/base/index"
+	],
+	"subpackages": [{
+			"root": "packageA",
+			"pages": [
+				"market/index",
+				"market/detail",
+				"shopping/index",
+				"orderForm/index",
+				"orderForm/detail",
+				"orderForm/add"
+			]
+		},
+		{
+			"root": "select",
+			"pages": [
+				"product/index"
+			]
+		},
+		{
+			"root": "public",
+			"pages": [
+				"files/index"
+			]
+		}
+	],
+	"preloadRule": {
+		"pages/home/index": {
+			"packages": [
+				"packageA",
+				"public",
+				"select"
+			],
+			"network": "all"
+		}
+	},
+	"usingComponents": {
+		"Yl_Empty": "/components/Yl_Empty/index",
+		"Yl_Filtrate": "/components/Yl_Filtrate/index",
+		"Yl_FloatingButton": "/components/Yl_FloatingButton/index",
+		"Yl_FunTabs": "/components/Yl_FunTabs/index",
+		"Yl_HeadNav": "/components/Yl_HeadNav/index",
+		"Yl_ListBox": "/components/Yl_ListBox/index",
+		"Yl_Tabbar": "/components/Yl_Tabbar/index",
+		"Yl_Field": "/components/Yl_Field/index",
+		"van-button": "@vant/weapp/button/index",
+		"van-cell": "@vant/weapp/cell/index",
+		"van-action-sheet": "@vant/weapp/action-sheet/index",
+		"van-popup": "@vant/weapp/popup/index",
+		"van-checkbox": "@vant/weapp/checkbox/index",
+		"van-checkbox-group": "@vant/weapp/checkbox-group/index",
+		"van-image": "@vant/weapp/image/index",
+		"van-loading": "@vant/weapp/loading/index",
+		"van-icon": "@vant/weapp/icon/index",
+		"van-tab": "@vant/weapp/tab/index",
+		"van-tabs": "@vant/weapp/tabs/index",
+		"van-search": "@vant/weapp/search/index"
+	},
+	"window": {
+		"backgroundTextStyle": "light",
+		"navigationBarBackgroundColor": "#085CDF",
+		"navigationBarTitleText": "E-订单",
+		"navigationBarTextStyle": "white"
+	},
+	"sitemapLocation": "sitemap.json"
 }

+ 14 - 23
packageA/orderForm/detail.js

@@ -6,10 +6,12 @@ Page({
 		tabsActive: 0,
 		tabsList: [{
 			label: "产品明细",
-			icon: "icon-tabxiangxixinxi1"
+			icon: "icon-tabxiangxixinxi1",
+			model: "#Product"
 		}, {
 			label: "附件",
-			icon: "icon-tabgenjinjilu"
+			icon: "icon-tabgenjinjilu",
+			model: "#Files"
 		}, {
 			label: "订单进度",
 			icon: "icon-tabcaozuojilu1"
@@ -54,36 +56,26 @@ Page({
 	},
 	//局部数据更新 tabs
 	partialRenewal(init = false) {
-		let id = this.data.detail.sa_orderid;
-		let model = '';
-		let name = this.data.tabsList[this.data.tabsActive].label;
-		switch (name) {
-			case "产品明细":
-				model = "#Product"
-				break;
-			case "附件":
-				model = "#Files"
-				break;
-		};
+		let model = this.data.tabsList[this.data.tabsActive].model;
 		if (model) {
-			let Component = this.selectComponent(model);
-			const {
-				total,
-				pageNumber,
-				pageTotal
-			} = Component.data.content;
+			let Component = this.selectComponent(model),
+				{
+					total,
+					pageNumber,
+					pageTotal
+				} = Component.data.content,
+				id = this.data.detail.sa_orderid;
 			if (total == null || init) {
 				Component.getList(id, init);
-			} else if (pageNumber <= pageTotal) {
+			} else if (pageNumber < pageTotal) {
 				Component.getList(id, false);
-			} else {
-				//用来判断 在搜索页面修改,与tabs选项不一致 但是切换到该选项 重置数据
 			}
 		}
 	},
 	onReachBottom() {
 		this.partialRenewal();
 	},
+	
 	/* 更新数据 */
 	changeDetail() {
 		let data = this.data.detail,
@@ -123,7 +115,6 @@ Page({
 			})
 		})
 	},
-
 	/* 修改订单备注 */
 	changeRemarks(e) {
 		let value = e.detail.value,

+ 2 - 1
packageA/orderForm/detail.json

@@ -1,5 +1,6 @@
 {
 	"usingComponents": {
-		"Product": "./modules/product/index"
+		"Product": "./modules/product/index",
+		"Files": "/public/files/index"
 	}
 }

+ 2 - 2
packageA/orderForm/detail.wxml

@@ -83,6 +83,6 @@
 
 <Yl_FunTabs list='{{tabsList}}' active='{{tabsActive}}' bind:onChenge="tabsChange">
 	<Product slot='产品明细' id='Product' />
+	<Files slot='附件' id='Files' />
 	<view style="height: 40rpx;" />
-</Yl_FunTabs>
-
+</Yl_FunTabs>

+ 10 - 8
packageA/orderForm/modules/product/index.js

@@ -28,7 +28,7 @@ Component({
 		getList(id, init) {
 			let content = this.data.content;
 			content.sa_orderid = id;
-			
+
 			if (init) content.pageNumber = 1;
 			_Http.basic({
 				"id": "20221109093902",
@@ -69,6 +69,10 @@ Component({
 		changeProduct({
 			detail
 		}) {
+			let obj = detail,
+				index = this.data.list.findIndex(v => v.itemid == detail.itemid),
+				data = this.data.list[index];
+			if (data.qty == obj.qty && data.remarks == obj.remarks && data.needdate == obj.needdate) return;
 			_Http.basic({
 				"id": 20221109093602,
 				"content": {
@@ -77,22 +81,20 @@ Component({
 				}
 			}).then(res => {
 				console.log("产品修改", res)
-				let obj = detail,
-					index = this.data.list.findIndex(v => v.itemid == detail.itemid);
-
 				if (res.msg != '成功') {
 					wx.showToast({
 						title: res.msg,
 						icon: "none"
 					});
-					obj = this.data.list[index];
+					obj = data;
 				};
-				this.data.list[index] = {
-					...this.data.list[index],
+				data = {
+					...data,
 					...obj
 				};
+				if (res.msg == '成功') data.amount = parseInt((data.qty * data.price).toFixed(2))
 				this.setData({
-					[`list[${index}]`]: this.data.list[index]
+					[`list[${index}]`]: data
 				})
 			})
 

+ 44 - 44
packageA/orderForm/modules/product/list/index.js

@@ -1,46 +1,46 @@
 Component({
-  properties: {
-    list: Array,
-    deleteItem: Function,
-    changeProduct: Function, //修改队列
-    disabled: Boolean
-  },
-  options: {
-    addGlobalClass: true
-  },
-  methods: {
-    onBlur(e) {
-      let {
-        data,
-        name
-      } = e.currentTarget.dataset;
-      this.triggerEvent("changeProduct", {
-        "sa_orderitemsid": data.sa_orderitemsid,
-        "itemid": data.itemid,
-        "qty": name == 'qty' ? e.detail.value : data.qty,
-        "remarks": name == 'remarks' ? e.detail.value : data.remarks,
-        needdate: data.needdate || "",
-        deliverydate: data.deliverydate || ""
-      })
-    },
-    changeDate(e) {
-      let {
-        data
-      } = e.currentTarget.dataset;
-      this.triggerEvent("changeProduct", {
-        "sa_orderitemsid": data.sa_orderitemsid,
-        "itemid": data.itemid,
-        "qty": data.qty,
-        "remarks": data.remarks,
-        needdate: e.detail.value || "",
-        deliverydate: data.deliverydate || ""
-      })
-    },
-    deleteProduct(e) {
-      let {
-        item
-      } = e.currentTarget.dataset;
-      this.triggerEvent("deleteItem", item)
-    }
-  }
+	properties: {
+		list: Array,
+		deleteItem: Function,
+		changeProduct: Function, //修改队列
+		disabled: Boolean
+	},
+	options: {
+		addGlobalClass: true
+	},
+	methods: {
+		onBlur(e) {
+			let {
+				data,
+				name
+			} = e.currentTarget.dataset;
+			this.triggerEvent("changeProduct", {
+				"sa_orderitemsid": data.sa_orderitemsid,
+				"itemid": data.itemid,
+				"qty": name == 'qty' ? e.detail.value : data.qty,
+				"remarks": name == 'remarks' ? e.detail.value : data.remarks,
+				needdate: data.needdate || "",
+				deliverydate: data.deliverydate || ""
+			})
+		},
+		changeDate(e) {
+			let {
+				data
+			} = e.currentTarget.dataset;
+			this.triggerEvent("changeProduct", {
+				"sa_orderitemsid": data.sa_orderitemsid,
+				"itemid": data.itemid,
+				"qty": data.qty,
+				"remarks": data.remarks,
+				needdate: e.detail.value || "",
+				deliverydate: data.deliverydate || ""
+			})
+		},
+		deleteProduct(e) {
+			let {
+				item
+			} = e.currentTarget.dataset;
+			this.triggerEvent("deleteItem", item)
+		}
+	}
 })

+ 69 - 69
packageA/orderForm/modules/product/list/index.wxml

@@ -1,74 +1,74 @@
 <view class="product-item" wx:for="{{list}}" wx:key="item.sa_quotedprice_itemsid">
-  <navigator class="product" url="#">
-    <view class="mian">
-      <view class="img" data-file="{{item.attinfos}}" catchtap="viewImage">
-        <van-image width="100%" height="100%" wx:if="{{item.cover}}" src="{{item.cover}}" use-loading-slot lazy-load>
-          <van-loading slot="loading" type="spinner" size="20" vertical />
-        </van-image>
-        <text wx:else class="err">暂无图片</text>
-      </view>
-      <view class="dec">
-        <view class="title">
-          <text class="line-1">{{item.itemname}}</text>
-          <text class="tag" wx:if="{{item.stockstatus}}">{{item.stockstatus}}</text>
-        </view>
-        <view class="subfield">
-          编号:{{item.itemno}}
-        </view>
-        <view class="subfield">
-          <text class="line-1" style="margin-right: 6rpx;">型号:{{item.model||' --'}}</text>
-          <text class="line-1">规格:{{item.spec||' --'}}</text>
-        </view>
-        <view class="subfield">
-          <text class="line-1" style="margin-right: 6rpx;">材质:{{item.material||' --'}}</text>
-          <text class="line-1">标准:{{item.standards||' --'}}</text>
-        </view>
-        <view class="subfield">
-          <text class="line-1" style="margin-right: 6rpx;">已发数量:{{item.deliedqty||' --'}}</text>
-          <text class="line-1" style="margin-right: 6rpx;">可退数量:{{item.returnqty||' --'}}</text>
-        </view>
-        <view style="margin-top: 8rpx;">
-          <text class="price">¥{{item.price}}</text>
-          <text class="old-price">¥{{item.marketprice}}</text>
-        </view>
-      </view>
-      <view class="delete" data-item="{{item}}" catchtap="deleteProduct">
-        <text class="iconfont icon-guanlian-shanchu" />
-      </view>
-    </view>
-  </navigator>
-  <view class="bot">
-    <view class="row">
-      <view>
-        <view class="label">数量<text wx:if="{{item.auxunit}}">({{item.auxunit}})</text>:</view>
-        <input class="input" style="width: 240rpx;" type="digit" value="{{item.qty}}" data-name="qty" data-data="{{item}}" bindblur="onBlur" />
-      </view>
-      <view class="money">
-        金额:<text>¥{{item.amount}}</text>
-      </view>
-    </view>
+	<navigator class="product" url="#">
+		<view class="mian">
+			<view class="img" data-file="{{item.attinfos}}" catchtap="viewImage">
+				<van-image width="100%" height="100%" wx:if="{{item.cover}}" src="{{item.cover}}" use-loading-slot lazy-load>
+					<van-loading slot="loading" type="spinner" size="20" vertical />
+				</van-image>
+				<text wx:else class="err">暂无图片</text>
+			</view>
+			<view class="dec">
+				<view class="title">
+					<text class="line-1">{{item.itemname}}</text>
+					<text class="tag" wx:if="{{item.stockstatus}}">{{item.stockstatus}}</text>
+				</view>
+				<view class="subfield">
+					编号:{{item.itemno}}
+				</view>
+				<view class="subfield">
+					<text class="line-1" style="margin-right: 6rpx;">型号:{{item.model||' --'}}</text>
+					<text class="line-1">规格:{{item.spec||' --'}}</text>
+				</view>
+				<view class="subfield">
+					<text class="line-1" style="margin-right: 6rpx;">材质:{{item.material||' --'}}</text>
+					<text class="line-1">标准:{{item.standards||' --'}}</text>
+				</view>
+				<view class="subfield">
+					<text class="line-1" style="margin-right: 6rpx;">已发数量:{{item.deliedqty||' --'}}</text>
+					<text class="line-1" style="margin-right: 6rpx;">可退数量:{{item.returnqty||' --'}}</text>
+				</view>
+				<view style="margin-top: 8rpx;">
+					<text class="price">¥{{item.price}}</text>
+					<text class="old-price" wx:if="{{item.price<item.marketprice}}">¥{{item.marketprice}}</text>
+				</view>
+			</view>
+			<view class="delete" data-item="{{item}}" catchtap="deleteProduct">
+				<text class="iconfont icon-guanlian-shanchu" />
+			</view>
+		</view>
+	</navigator>
+	<view class="bot">
+		<view class="row">
+			<view>
+				<view class="label">数量<text wx:if="{{item.auxunit}}">({{item.auxunit}})</text>:</view>
+				<input class="input" style="width: 240rpx;" type="digit" value="{{item.qty}}" data-name="qty" data-data="{{item}}" bindblur="onBlur" />
+			</view>
+			<view class="money">
+				金额:<text>¥{{item.amount}}</text>
+			</view>
+		</view>
 
-    <view class="row">
-      <view style="width: 100%;">
-        <view class="label">产品备注:</view>
-        <input class="input" style="flex: 1; text-align: left;padding-left: 10rpx;" type="text" placeholder="备注" value="{{item.remarks}}" data-name="remarks" data-data="{{item}}" bindblur="onBlur" />
-      </view>
-    </view>
+		<view class="row">
+			<view style="width: 100%;">
+				<view class="label">产品备注:</view>
+				<input class="input" style="flex: 1; text-align: left;padding-left: 10rpx;" type="text" placeholder="备注" value="{{item.remarks}}" data-name="remarks" data-data="{{item}}" bindblur="onBlur" />
+			</view>
+		</view>
 
-    <view class="row">
-      <view>
-        <view class="label">期望交期:</view>
-        <picker mode="date" data-data="{{item}}" bindchange='changeDate'>
-          <view class="input" style="width: 240rpx;display: flex;justify-content: center;">
-            <text wx:if="{{item.needdate }}">{{item.needdate}}</text>
-            <text wx:else style="color: #999;">期望交期</text>
-          </view>
-        </picker>
-      </view>
-      <view class="money">
-        回复交期:{{item.deliverydate || ' --'}}
-      </view>
-    </view>
-  </view>
+		<view class="row">
+			<view>
+				<view class="label">期望交期:</view>
+				<picker mode="date" data-data="{{item}}" bindchange='changeDate'>
+					<view class="input" style="width: 240rpx;display: flex;justify-content: center;">
+						<text wx:if="{{item.needdate }}">{{item.needdate}}</text>
+						<text wx:else style="color: #999;">期望交期</text>
+					</view>
+				</picker>
+			</view>
+			<view class="money">
+				回复交期:{{item.deliverydate || ' --'}}
+			</view>
+		</view>
+	</view>
 </view>
 <Yl_Empty wx:if="{{list.length==0}}" />

+ 7 - 4
select/product/index.js

@@ -43,10 +43,13 @@ Page({
 				icon: "none"
 			})
 			res.data = res.data.map(value => {
-				if (value.attinfos.length == 0) return value;
-				value.attinfos = file.fileList(value.attinfos)
-				let image = value.attinfos.find(v => v.fileType == "image");
-				value.cover = image ? image.cover : "";
+				if (value.attinfos.length != 0) {
+					value.attinfos = file.fileList(value.attinfos)
+					let image = value.attinfos.find(v => v.fileType == "image");
+					value.cover = image ? image.cover : "";
+				}
+				value.brandName = value.brand.map(name => name.brandname)
+				value.tradefields = value.tradefield.map(name => name.tradefield)
 				return value;
 			})
 

+ 4 - 4
select/product/index.wxml

@@ -1,4 +1,4 @@
-<import src="index.skeleton.wxml"/>
+<import src="index.skeleton.wxml" />
 <template is="skeleton" wx:if="{{loading}}" />
 
 <van-search class="search" value="{{ params.content.where.condition }}" shape="round" placeholder="请输入搜索关键词" bind:search='startSearch' bind:clear='onClear' />
@@ -20,11 +20,11 @@
 					{{item.itemname}}
 				</view>
 				<view class="subfield line-1">
-					<text>品牌:{{item.brandName}}</text>
-					产品类别:{{item.className}}
+					<text>品牌:{{item.brandName}}sdf sdf sdf</text>
+					领域:{{item.tradefields}}
 				</view>
 				<view class="price line-1">
-					牌价:<text class="num">¥{{item.marketprice}}</text><text>/{{item.axunitname}}</text>
+					价格:<text class="num">¥{{item.gradeprice}}</text><text wx:if="{{item.gradeprice<item.oldprice}}" style="text-decoration:line-through; color:#999;">/{{item.oldprice}}</text>
 				</view>
 			</view>
 		</view>