ソースを参照

新建客户暂存

xiaohaizhao 2 ヶ月 前
コミット
598fde6020

+ 16 - 6
CRM/customer/create.js

@@ -82,12 +82,23 @@ Page({
       label: "选择线索",
       error: false,
       errMsg: "",
-      type: "text",
-      value: "未做功能",
+      type: "route",
+      url: "/select/lead/index",
+      params: {
+        "id": 20221101094502,
+        "content": {
+          "pageNumber": 1,
+          "pageSize": 20,
+          "where": {
+            "condition": "",
+          },
+        },
+      },
+      query: '&radio=true',
+      value: "",
       placeholder: "选择线索",
       valueName: "sat_orderclueid",
-      required: false,
-      disabled: true
+      required: false
     }, {
       label: "外部订单号",
       error: false,
@@ -190,8 +201,7 @@ Page({
       content.county = content.region[2] || "";
       delete content.region;
     }
-
-    content.sat_orderclueid = ''
+    content.sat_orderclueid = content.sat_orderclueid ? content.sat_orderclueid[1][0] : ''
     _Http.basic({
       "id": "2026030916370001",
       content

+ 2 - 1
app.json

@@ -87,7 +87,8 @@
         "address/addAndEdit",
         "workOrder/index",
         "workOrderProduct/index",
-        "addPreciseSearch/index"
+        "addPreciseSearch/index",
+        "lead/index"
       ]
     },
     {

+ 8 - 8
project.private.config.json

@@ -25,23 +25,23 @@
     "miniprogram": {
       "list": [
         {
-          "name": "客户列表",
-          "pathName": "CRM/customer/index",
-          "query": "",
+          "name": "CRM/customer/detail",
+          "pathName": "CRM/customer/detail",
+          "query": "id=2205874",
           "scene": null,
           "launchMode": "default"
         },
         {
-          "name": "CRM/warehouse/index",
-          "pathName": "CRM/warehouse/index",
+          "name": "客户列表",
+          "pathName": "CRM/customer/index",
           "query": "",
           "launchMode": "default",
           "scene": null
         },
         {
-          "name": "CRM/customer/detail",
-          "pathName": "CRM/customer/detail",
-          "query": "id=-12170327",
+          "name": "CRM/warehouse/index",
+          "pathName": "CRM/warehouse/index",
+          "query": "",
           "launchMode": "default",
           "scene": null
         },

+ 123 - 0
select/lead/index.js

@@ -0,0 +1,123 @@
+const _Http = getApp().globalData.http;
+
+Page({
+	data: {
+		loading: true,
+		params: {}, //请求体
+		result: [], //返回结果
+		radio: false, //是否为单选
+		idname: "sat_orderclueid", //idkey
+		showName: "name"
+	},
+	onLoad(options) {
+		if (options.params) {
+			let params = JSON.parse(options.params);
+			if (!params.content.pageNumber || !params.content.pageTotal) {
+				params.content.pageNumber = 1;
+				params.content.pageTotal = 1;
+			}
+			this.setData({
+				params
+			});
+		};
+		this.setData({
+			radio: options.radio ? true : false,
+			idname: options.idname || this.data.idname,
+			showName: options.showName || this.data.showName
+		});
+		this.getList();
+	},
+	getList(init = false) {
+		//init 用于初始化分页
+		if (init.detail != undefined) init = init.detail;
+		let params = this.data.params;
+		if (init) params.content.pageNumber = 1
+		if (params.content.pageNumber > params.content.pageTotal) return;
+		_Http.basic(params).then(res => {
+			console.log("选择线索列表", res)
+			this.selectComponent('#ListBox').RefreshToComplete();
+			if (res.msg != '成功') return wx.showToast({
+				title: res.msg,
+				icon: "none"
+			})
+			this.setData({
+				'params.content.pageNumber': res.pageNumber + 1,
+				'params.content.pageTotal': res.pageTotal,
+				'params.content.total': res.total,
+				list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
+				loading: false
+			})
+		})
+	},
+	/* 选中 */
+	changeResult(e) {
+		let {
+			id,
+			item
+		} = e.currentTarget.dataset, result = this.data.result;
+		if (this.data.radio) {
+			result = [id];
+		} else {
+			let isAdd = result.some(v => v == id);
+			if (!isAdd) {
+				if (item.iscustomsize == 1) {
+					if ((item.widthschemeid && item.width == 0) || (item.lengthschemeid && item.length == 0)) {
+						item.pitchOn = true;
+						this.bindChangeFun()
+						if (item) this.selectComponent("#Custom").onClick(item)
+					} else {
+						result.push(id)
+					}
+				} else {
+					result.push(id)
+				}
+			} else {
+				result = result.filter(v => v != id)
+			}
+		}
+		this.setData({
+			result
+		});
+		if (this.data.radio) this.submit();
+	},
+	/* 提交 */
+	submit() {
+		let result = this.data.result,
+			obj = this.data.radio ? {
+				id: result,
+				item: this.data.list.find(value => value[this.data.idname] == result),
+				value: [this.data.list.find(value => value[this.data.idname] == result)[this.data.showName], result]
+			} : {
+				result,
+				list: result.map(v => this.data.list.find(value => value[this.data.idname] == v)),
+				value: [result.map(v => {
+					let data = this.data.list.find(value => value[this.data.idname] == v);
+					return data ? data[this.data.showName] : ""
+				}), result]
+			}
+		getApp().globalData.handleSelect && getApp().globalData.handleSelect(obj)
+	},
+	/* 开始搜索 */
+	startSearch({
+		detail
+	}) {
+		let condition = this.data.content ? this.data.content.where.condition : this.data.params.content.where.condition;
+		if (detail == condition) return;
+		this.setData({
+			'content.where.condition': detail,
+			'params.content.where.condition': detail
+		});
+		this.getList(true);
+	},
+	/* 取消搜索 */
+	onClear() {
+		this.setData({
+			'content.where.condition': "",
+			'params.content.where.condition': ""
+		});
+		this.getList(true);
+	},
+	onUnload() {
+		getApp().globalData.handleSelect = null;
+	}
+})

+ 4 - 0
select/lead/index.json

@@ -0,0 +1,4 @@
+{
+  "usingComponents": {},
+  "navigationBarTitleText": "选择线索"
+}

+ 134 - 0
select/lead/index.scss

@@ -0,0 +1,134 @@
+page {
+	height: 100vh;
+	overflow: hidden;
+}
+
+.total {
+	height: 60rpx;
+	line-height: 60rpx;
+	font-size: 24rpx;
+	font-family: PingFang SC-Regular, PingFang SC;
+	color: #666666;
+	padding-left: 30rpx;
+}
+
+.setclient-list-item {
+	width: 100vw;
+	background-color: #FFFFFF;
+	border-bottom: 1rpx solid #DDDDDD;
+	margin-bottom: 20rpx;
+
+	.mian {
+		position: relative;
+		display: flex;
+		align-items: center;
+		width: 100%;
+		padding: 20rpx 30rpx;
+		box-sizing: border-box;
+
+		.checkbox {
+			position: absolute;
+			top: 20rpx;
+			right: 10rpx;
+		}
+
+		.img {
+			flex-shrink: 0;
+			width: 128rpx;
+			height: 128rpx;
+			border-radius: 16rpx;
+			margin-right: 30rpx;
+			overflow: hidden;
+
+			.err {
+				display: flex;
+				width: 100%;
+				height: 100%;
+				align-items: center;
+				justify-content: center;
+				font-size: 22rpx;
+				border: 1px solid #ddd;
+				box-sizing: border-box;
+				color: #666;
+			}
+		}
+
+		.dec {
+			flex: 1;
+			width: 0;
+			min-height: 128rpx;
+			height: 100%;
+			font-size: 24rpx;
+			font-family: PingFang SC-Regular, PingFang SC;
+			color: #999999;
+
+			.title {
+				height: 40rpx;
+				line-height: 40rpx;
+				font-size: 28rpx;
+				font-family: PingFang SC-Semibold, PingFang SC;
+				font-weight: 600;
+				color: #333333;
+			}
+
+			.subfield {
+				margin-top: 6rpx;
+				line-height: 34rpx;
+
+
+				text {
+					display: inline-block;
+					max-width: 250rpx;
+					min-width: 150rpx;
+				}
+			}
+
+			.price {
+				height: 40rpx;
+				line-height: 40rpx;
+				margin-top: 8rpx;
+
+				.num {
+					font-size: 28rpx;
+					color: #FF3B30;
+					font-weight: 600;
+				}
+
+				text {
+					color: #333333;
+				}
+			}
+		}
+	}
+}
+
+.footer {
+	display: flex;
+	justify-content: space-between;
+	align-items: 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;
+
+	.count {
+		font-size: 28rpx;
+		font-family: PingFang SC-Regular, PingFang SC;
+		color: #333333;
+	}
+
+	.but {
+		width: 156rpx;
+		height: 90rpx;
+		background: #3874F6;
+		border-radius: 8rpx;
+		font-size: 28rpx;
+		font-family: PingFang SC-Bold, PingFang SC;
+		font-weight: bold;
+		color: #FFFFFF;
+	}
+}

+ 63 - 0
select/lead/index.wxml

@@ -0,0 +1,63 @@
+<van-search class="search" value="{{ params.content.where.condition }}" shape="round" placeholder="请输入搜索关键词" bind:search='startSearch' bind:clear='onClear' />
+<view class="total">共{{params.content.total}}个</view>
+
+<Yl_ListBox id='ListBox' bind:getlist='getList'>
+    <view class="setclient-list-item" wx:for="{{list}}" wx:key="sat_orderclueid">
+        <navigator url="#" class="mian" data-id="{{item[idname]}}" data-item="{{item}}" bindtap="changeResult">
+            <view class="checkbox">
+                <van-checkbox wx:if="{{!radio}}" value="{{ handle.isCheck(item[idname],result) }}" shape="square" icon-size='28rpx' />
+            </view>
+            <view class="dec">
+                <view class="title line-1">
+                    {{item.name || '--'}}
+                </view>
+                <view class="subfield">
+                    手机号:{{item.phonenumber || '--'}}
+                </view>
+                <view class="subfield">
+                    省市县:{{(item.province || '') + '-' + (item.city || '') + '-' + (item.county || '') || '--'}}
+                </view>
+                <view class="subfield line-1">
+                    地址:{{item.address || '--'}}
+                </view>
+                <view class="subfield">
+                    来源:{{item.cluesource || '--'}}
+                </view>
+                <view class="subfield">
+                    负责人:{{item.leadername || '--'}}
+                </view>
+                <view class="subfield">
+                    状态:{{item.status || '--'}}
+                </view>
+                <view class="subfield">
+                    最后一次跟进结果:{{item.logtype || '--'}}
+                </view>
+                <view class="subfield line-1">
+                    跟进内容:{{item.followcontent || '--'}}
+                </view>
+            </view>
+        </navigator>
+    </view>
+    <view wx:if="{{!radio}}" style="height: 130rpx;" />
+    <Yl_Empty wx:if="{{list.length==0}}" />
+</Yl_ListBox>
+
+<block wx:if="{{!radio}}">
+    <view class="footer">
+        <view class="count">
+            已选:{{result.length}}
+        </view>
+        <van-button custom-class='but' disabled='{{result.length==0}}' bind:click="submit">确定</van-button>
+    </view>
+    <wxs module="handle">
+        module.exports = {
+            isCheck: function (id, list) {
+                return list.some(function (v) {
+                    return v == id
+                });
+            },
+        }
+    </wxs>
+</block>
+
+<wxs src="/utils/hidePrice.wxs" module="handleHide" />