Browse Source

我的地址

xiaohaizhao 2 years ago
parent
commit
04c523ca27

+ 2 - 2
packageA/market/modules/list/index.wxml

@@ -13,8 +13,8 @@
 			<view style="background: #FA8C16;">
 				{{item.brandname}}
 			</view>
-			<view wx:for="{{item.tag1}}" style="background: #FF3B30;">
-				{{item}}
+			<view wx:if="{{item.tradefield}}" style="background: #FF3B30;">
+				{{item.tradefield}}
 			</view>
 		</view>
 		<view class="price">

+ 53 - 53
packageA/remitVoucher/detail.js

@@ -16,7 +16,7 @@ Page({
 			}
 			return value;
 		},
-		show:false,
+		show: false,
 		tabsList: [{
 			label: "详细信息",
 			icon: "icon-tabchanpin"
@@ -51,18 +51,18 @@ Page({
 			let tabbarsList = []
 			if (res.data.status == '新建') tabbarsList = [{
 				label: "编辑",
-            	icon: "icon-dibu-bianji"
-			},{
+				icon: "icon-dibu-bianji"
+			}, {
 				label: "提交",
-            	icon: "icon-tijiao",
-			},{
+				icon: "icon-tijiao",
+			}, {
 				label: "删除",
 				icon: "icon-guanlian-shanchu"
 			}]
 			if (res.data.status == '提交') tabbarsList = [{
 				label: "审核",
 				icon: "icon-shenhe"
-			},{
+			}, {
 				label: "退回",
 				icon: "icon-a-fanshenhetuihui"
 			}]
@@ -94,7 +94,7 @@ Page({
 			}, {
 				label: "经销商简称",
 				value: data.enterprisename
-			},{
+			}, {
 				label: "回款归属月份",
 				value: data.period
 			}, {
@@ -126,33 +126,33 @@ Page({
 		})
 	},
 	/* 审核选择弹出框关闭 */
-	onClose () {
+	onClose() {
 		this.setData({
 			show: false
 		})
 	},
 	/* 审核提交 */
-	async checkSubmit ({
+	async checkSubmit({
 		detail
 	}) {
 		let res = await _Http.basic({
-			 "id": "20221226153304",
+			"id": "20221226153304",
 			"content": {
-				"sa_paybillid":this.data.sa_paybillid,
-				"period":getTime.formatTime(new Date(detail), '-').split(' ')[0]
+				"sa_paybillid": this.data.sa_paybillid,
+				"period": getTime.formatTime(new Date(detail), '-').split(' ')[0]
 			}
 		})
 		console.log(res);
 		if (res.msg == '成功') {
 			this.setData({
-				show:false
+				show: false
 			})
 			this.getDetail(true)
 		}
 	},
 	tabbarOnClick({
-        detail
-    }) {
+		detail
+	}) {
 		switch (detail.label) {
 			case "编辑":
 				wx.navigateTo({
@@ -169,7 +169,7 @@ Page({
 						if (confirm) _Http.basic({
 							"id": "20221226153204",
 							"content": {
-								"sa_paybillid":this.data.sa_paybillid
+								"sa_paybillid": this.data.sa_paybillid
 							}
 						}).then(res => {
 							wx.showToast({
@@ -188,11 +188,11 @@ Page({
 				break;
 			case "审核":
 				wx.showToast({
-					title:'请选择回款日期',
-					icon:'none'
+					title: '请选择回款日期',
+					icon: 'none'
 				})
 				this.setData({
-					show:true
+					show: true
 				})
 				break;
 			case "退回":
@@ -203,9 +203,9 @@ Page({
 						confirm
 					}) => {
 						if (confirm) _Http.basic({
-							"id":20221227110104,
+							"id": 20221227110104,
 							"content": {
-								sa_paybillid:this.data.sa_paybillid
+								sa_paybillid: this.data.sa_paybillid
 							}
 						}).then(res => {
 							wx.showToast({
@@ -220,35 +220,35 @@ Page({
 				})
 				break;
 			case "删除":
-			wx.showModal({
-				title: '提示',
-				content: `是否删除该凭证?`,
-				complete: ({
-					confirm
-				}) => {
-					if (confirm) _Http.basic({
-						"id":20221226153104,
-						"content": {
-							sa_paybillids:[this.data.sa_paybillid]
-						}
-					}).then(res => {
-						wx.showToast({
-							title: res.msg == '成功' ? `已删除该凭证` : res.msg,
-							icon: "none"
-						});
-						if (res.msg == '成功') {
-							setTimeout(() => {
-								wx.navigateBack()
-								getCurrentPages()[getCurrentPages().length - 2].getList(true)
-							},300)
-						}
-					})
-				}
-			})
-			break;
-        }
+				wx.showModal({
+					title: '提示',
+					content: `是否删除该凭证?`,
+					complete: ({
+						confirm
+					}) => {
+						if (confirm) _Http.basic({
+							"id": 20221226153104,
+							"content": {
+								sa_paybillids: [this.data.sa_paybillid]
+							}
+						}).then(res => {
+							wx.showToast({
+								title: res.msg == '成功' ? `已删除该凭证` : res.msg,
+								icon: "none"
+							});
+							if (res.msg == '成功') {
+								setTimeout(() => {
+									wx.navigateBack()
+									getCurrentPages()[getCurrentPages().length - 2].getList(true)
+								}, 300)
+							}
+						})
+					}
+				})
+				break;
+		}
 	},
-	onInput (detail) {
+	onInput(detail) {
 
 	},
 	//tabs 切换
@@ -257,8 +257,8 @@ Page({
 	}) {
 		this.setData({
 			tabsActive: detail
-        });
-        console.log(this.data.tabsActive);
+		});
+		console.log(this.data.tabsActive);
 		this.partialRenewal();
 	},
 	//局部数据更新 tabs
@@ -271,7 +271,7 @@ Page({
 					pageNumber,
 					pageTotal
 				} = Component.data.content,
-                id = this.data.detail.sa_paybillid;
+				id = this.data.detail.sa_paybillid;
 			if (total == null || init) {
 				Component.getList(id, init);
 			} else if (pageNumber < pageTotal) {
@@ -287,7 +287,7 @@ Page({
 		let page = getCurrentPages().find(v => v.__route__ == 'packageA/remitVoucher/index');
 		let content = JSON.parse(JSON.stringify(page.data.content));
 		content.pageNumber = 1;
-		content.pageSize = page.data.list.length;
+		content.pageSize = (page.data.content.pageNumber - 1) * page.data.content.pageSize;
 		_Http.basic({
 			"id": 20230111141104,
 			content

+ 60 - 0
pages/tabbar/mine/address/index.js

@@ -0,0 +1,60 @@
+const _Http = getApp().globalData.http;
+Page({
+  data: {
+    "content": {
+      nocache: true,
+      sys_enterpriseid: "",
+      pageNumber: 1,
+      pageTotal: 1,
+      "where": {
+        "condition": "",
+        "workaddress": 1
+      }
+    }
+  },
+  onLoad(options) {
+    this.setData({
+      "content.sys_enterpriseid": options.id
+    })
+    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;
+    _Http.basic({
+      "id": "20221009155803",
+      content
+    }).then(res => {
+      console.log("我的地址列表", res)
+      this.selectComponent('#ListBox').RefreshToComplete();
+      if (res.msg != '成功') return wx.showToast({
+        title: res.msg,
+        icon: "none",
+        mask: true
+      });
+      content.pageNumber = res.pageNumber + 1;
+      content.pageTotal = res.pageTotal;
+      this.setData({
+        list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data)
+      })
+    })
+  },
+  /* 开始搜索 */
+  onSearch({
+    detail
+  }) {
+    if (detail == this.data.content.where.condition) return;
+    this.data.content.where.condition = detail;
+    this.getList(true);
+  },
+  onClear(e) {
+    this.data.content.where.condition = "";
+    this.getList(true);
+  },
+  onReady() {
+    this.selectComponent("#ListBox").setHeight(".top", this);
+  }
+})

+ 5 - 0
pages/tabbar/mine/address/index.json

@@ -0,0 +1,5 @@
+{
+  "usingComponents": {
+    "List": "./modules/list/index"
+  }
+}

+ 0 - 0
pages/tabbar/mine/address/index.scss


+ 7 - 0
pages/tabbar/mine/address/index.wxml

@@ -0,0 +1,7 @@
+<van-search class="top" value="{{ content.where.condition }}" use-action-slot placeholder="请输入搜索关键词" bind:search="onSearch" bind:clear='onClear'>
+	<navigator url="/pages/tabbar/mine/address/update?id={{content.sys_enterpriseid}}" slot="action">添加地址</navigator>
+</van-search>
+<Yl_ListBox id='ListBox' bind:getlist='getList'>
+	<view style="height: 20rpx;" />
+	<List list="{{list}}" />
+</Yl_ListBox>

+ 11 - 0
pages/tabbar/mine/address/modules/list/index.js

@@ -0,0 +1,11 @@
+Component({
+  properties: {
+    list: Array
+  },
+  data: {
+
+  },
+  methods: {
+
+  }
+})

+ 4 - 0
pages/tabbar/mine/address/modules/list/index.json

@@ -0,0 +1,4 @@
+{
+  "component": true,
+  "usingComponents": {}
+}

+ 35 - 0
pages/tabbar/mine/address/modules/list/index.scss

@@ -0,0 +1,35 @@
+.item {
+    width: 100vw;
+    margin-bottom: 20rpx;
+    background-color: #ffffff;
+
+    .content {
+        position: relative;
+        padding: 20rpx 30rpx;
+        padding-top: 0;
+        box-sizing: border-box;
+
+        .num {
+            height: 40rpx;
+            line-height: 40rpx;
+            font-size: 28rpx;
+            color: #333333;
+            padding: 20rpx 0 10rpx;
+            font-weight: 700;
+        }
+
+        .exp {
+            line-height: 34rpx;
+            font-size: 24rpx;
+            margin-bottom: 8rpx;
+            color: #999999;
+        }
+    }
+}
+
+/* 文本行数限制 */
+.line-1 {
+    overflow: hidden;
+    white-space: nowrap;
+    text-overflow: ellipsis;
+}

+ 15 - 0
pages/tabbar/mine/address/modules/list/index.wxml

@@ -0,0 +1,15 @@
+<view class="item" wx:for="{{list}}" wx:key="index">
+	<navigator url="#" class="content">
+		<view class="num">
+			{{item.name}} {{item.phonenumber}}
+		</view>
+		<view class="exp">
+			省市县:{{(item.province + item.city + item.county)||" --"}}
+		</view>
+		<view class="exp">
+			地址:{{item.address|| ' --'}}
+		</view>
+	</navigator>
+</view>
+
+<Yl_Empty wx:if="{{list.length==0}}" />

+ 121 - 0
pages/tabbar/mine/address/update.js

@@ -0,0 +1,121 @@
+const _Http = getApp().globalData.http;
+let sys_enterpriseid = null;
+Page({
+    data: {
+        form: [{
+            label: "联系人",
+            error: false,
+            errMsg: "",
+            type: "text",
+            value: "",
+            placeholder: "请填写",
+            valueName: "name",
+            required: true,
+            checking: "base"
+        }, {
+            label: "手机号",
+            error: false,
+            errMsg: "",
+            type: "number",
+            value: "",
+            placeholder: "联系人手机号码",
+            valueName: "phonenumber",
+            required: true,
+            checking: "phone"
+        }, {
+            label: "省市县",
+            error: false,
+            errMsg: "",
+            type: "region",
+            value: [],
+            placeholder: "省,市,县",
+            valueName: "region",
+            required: true
+        }, {
+            label: "详细地址",
+            error: false,
+            errMsg: "",
+            type: "textarea",
+            value: "",
+            placeholder: "例: 科创园11栋1103室",
+            valueName: "address",
+            required: true,
+            checking: "base"
+        }, {
+            label: "备注",
+            error: false,
+            errMsg: "",
+            type: "textarea",
+            value: "",
+            placeholder: "地址说明",
+            valueName: "remarks",
+            required: false,
+            checking: "base"
+        }],
+        disabled: true
+    },
+    onLoad(options) {
+        sys_enterpriseid = options.id
+    },
+    submit() {
+        let content = Object.assign({
+            "contactsid": 0,
+            sys_enterpriseid,
+            sex: "男",
+            "name": "",
+            "depname": "",
+            "position": "",
+            "isleader": 1,
+            "birthday": "",
+            "phonenumber": "",
+            "email": "",
+            "address": "",
+            "remarks": "",
+            "workaddress": 1,
+            "isdefault": 0
+        }, this.selectComponent("#Form").submit());
+        content.province = content.region[0] || "";
+        content.city = content.region[1] || "";
+        content.county = content.region[2] || "";
+        delete(content.region);
+        _Http.basic({
+            id: 20221009155703,
+            content
+        }).then(res => {
+            console.log("新建地址", res)
+            wx.showToast({
+                title: res.msg != '成功' ? res.msg : "添加成功",
+                icon: "none",
+                mask: true
+            });
+            if (res.msg == '成功') setTimeout(() => {
+                wx.navigateBack();
+                let page = getCurrentPages().find(v => v.route == 'pages/tabbar/mine/address/index');
+                if (page) {
+                    let content = JSON.parse(JSON.stringify(page.data.content));
+                    content.pageNumber = 1;
+                    content.pageSize = (page.data.content.pageNumber - 1) * (page.data.content.pageSize || 20);
+                    _Http.basic({
+                        "id": "20221009155803",
+                        content
+                    }).then(res => {
+                        if (res.msg == '成功') page.setData({
+                            list: res.data
+                        })
+                    })
+                }
+            }, 500)
+
+
+
+        })
+    },
+    /* 表单是否填写完成 */
+    onConfirm({
+        detail
+    }) {
+        this.setData({
+            disabled: detail
+        })
+    },
+})

+ 3 - 0
pages/tabbar/mine/address/update.json

@@ -0,0 +1,3 @@
+{
+  "usingComponents": {}
+}

+ 26 - 0
pages/tabbar/mine/address/update.scss

@@ -0,0 +1,26 @@
+.footer {
+	display: flex;
+	justify-content: center;
+	padding: 0 30rpx;
+	position: fixed;
+	width: 100vw;
+	height: 130rpx;
+	background: #FFFFFF;
+	box-shadow: 0px -4rpx 16rpx 2rpx rgba(150, 157, 165, 0.16);
+	bottom: 0;
+	box-sizing: border-box;
+	z-index: 9999;
+	padding-top: 10rpx;
+
+	.but {
+		width: 690rpx;
+		height: 90rpx;
+		background: var(--warning);
+		border-radius: 16rpx;
+		font-size: 28rpx;
+		font-family: PingFang SC-Bold, PingFang SC;
+		font-weight: bold;
+		color: #fff;
+	}
+
+}

+ 5 - 0
pages/tabbar/mine/address/update.wxml

@@ -0,0 +1,5 @@
+<Yl_Field id='Form' form="{{form}}" bind:onConfirm='onConfirm' />
+
+<view class="footer">
+	<van-button custom-class='but' bind:click="submit" disabled='{{disabled}}'>保存地址</van-button>
+</view>

+ 1 - 0
pages/tabbar/mine/index.scss

@@ -53,6 +53,7 @@
     background-color: #fff;
     margin-top: 40rpx;
     border-radius: 16rpx;
+    overflow: hidden;
 
     .item {
         width: 100%;

+ 12 - 2
pages/tabbar/mine/index.wxml

@@ -14,7 +14,17 @@
 </view>
 
 <view class="operating">
-
+    <navigator class="item" wx:if="{{userMsg.enterprise.sys_enterpriseid}}" url="/pages/tabbar/mine/address/index?id={{userMsg.enterprise.sys_enterpriseid}}">
+        <view class="con">
+            <view class="label">
+                <text class="iconfont icon-a-wodemendianxinxidizhi" style="color: #085CDF;" />
+                我的地址
+            </view>
+            <view class="item-right">
+                <van-icon size='30rpx' name="arrow" />
+            </view>
+        </view>
+    </navigator>
     <navigator class="item" url="{{item.name=='团队管理'?item.path+'?auth='+teamAuth:item.path}}" wx:for="{{pathList}}">
         <view class="con">
             <view class="label">
@@ -43,7 +53,7 @@
             </view>
         </view>
     </navigator>
-    
+
 </view>
 <view style="width: 100vw;text-align: center;margin-top: 200rpx;">
     <van-button custom-class='out-login' color="#CCC" bindtap="outLogin" plain>退出登录</van-button>