zhaoxiaohai пре 3 година
родитељ
комит
546add417b

+ 8 - 0
packageA/clockIn/index.js

@@ -0,0 +1,8 @@
+Page({
+    data: {
+
+    },
+    onLoad(options) {
+
+    },
+})

+ 3 - 0
packageA/clockIn/index.json

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

+ 1 - 0
packageA/clockIn/index.scss

@@ -0,0 +1 @@
+/* packageA/clockIn/index.wxss */

+ 1 - 0
packageA/clockIn/index.wxml

@@ -0,0 +1 @@
+<navigator url="/packageA/clockIn/signIn">签到</navigator>

+ 307 - 0
packageA/clockIn/signIn.js

@@ -0,0 +1,307 @@
+const _Http = getApp().globalData.http;
+const QQMapWX = require('../../utils/qqmap-wx-jssdk.min'),
+	qqmapsdk = new QQMapWX({
+		key: 'QF6BZ-4IQC5-SN2IH-QL5BW-U4IJO-R3BY4' // 必填
+	});
+import {
+	formatTime
+} from "../../utils/getTime";
+
+let timing = null;
+Page({
+	data: {
+		markers: [],
+		content: {},
+		time: formatTime(new Date(), '-'),
+		form: null,
+		continue1: null,
+	},
+	onLoad(options) {
+		this.getLocation();
+		timing = setInterval(() => {
+			this.setData({
+				time: formatTime(new Date(), '-')
+			})
+		}, 1000);
+		this.rander();
+	},
+	submit() {
+		let data = this.selectComponent("#Form").submit(),
+			content = this.data.content,
+			continue1 = this.data.continue1,
+			that = this;
+		content.remarks = data.remarks;
+		if (continue1 == null) {
+			wx.showModal({
+				title: '提示',
+				content: '是否确认本次签到',
+				complete: (res) => {
+					if (res.confirm) that.onConfirm(content);
+				}
+			})
+		} else {
+			content.ownertable = data[continue1] == '' ? continue1 == 'sa_project' ? 'sys_enterprise' : 'sa_project' : continue1;
+			content.ownerid = data[content.ownertable][1][0];
+
+			wx.showModal({
+				title: '提示',
+				content: `本次签到将跟进${content.ownertable=='sa_project'?'项目':'客户'}“${data[content.ownertable][0]}”`,
+				complete: (res) => {
+					if (res.confirm) that.onConfirm(content);
+				}
+			})
+		}
+	},
+	onConfirm(content) {
+		_Http.basic({
+			id: 20221229145901,
+			content
+		}).then(res => {
+			console.log("签到", res)
+			wx.showToast({
+				title: res.msg == '成功' ? '签到成功' : res.msg,
+				icon: "none"
+			})
+			if (res.msg == '成功') setTimeout(() => {
+				wx.navigateBack();
+			}, 500)
+		})
+	},
+	rander() {
+		this.setData({
+			form: [{
+				label: "客户",
+				error: false,
+				errMsg: "",
+				type: "route",
+				url: "/packageA/select/setclient/select",
+				radio: true,
+				value: "",
+				params: {
+					"id": 20221012164402,
+					content: {
+						nocache: true,
+						"type": 0,
+						"pageNumber": 1,
+						"pageSize": 20,
+						"isExport": 0,
+						"where": {
+							"condition": "",
+						},
+						"sort": [{
+							sortname: "默认",
+							sorted: 1,
+							sortid: 67,
+							reversed: 0
+						}]
+					},
+				},
+				placeholder: "选择客户",
+				valueName: "sys_enterprise",
+				checking: "base",
+				required: false
+			}, {
+				label: "项目",
+				error: false,
+				errMsg: "",
+				type: "route",
+				url: "/packageA/select/project/select",
+				radio: true,
+				value: "",
+				params: {
+					"id": 20221020143502,
+					content: {
+						nocache: true,
+						"type": 0,
+						"pageNumber": 1,
+						"pageSize": 20,
+						"where": {
+							"condition": "", //模糊搜索
+						},
+					},
+				},
+				placeholder: "选择项目",
+				valueName: "sa_project",
+				checking: "base",
+				required: false
+			}, {
+				label: "说明",
+				error: false,
+				errMsg: "",
+				type: "textarea",
+				value: "",
+				placeholder: "请填写",
+				valueName: "remarks",
+				required: false, //必填
+			}],
+			continue1: null
+		})
+	},
+	/* 打断处理form */
+	interrupt(e) {
+		let {
+			data,
+			form
+		} = e.detail,
+			that = this;
+		console.log("处理", data, form)
+		if (this.data.continue1 == null) {
+			wx.showModal({
+				title: '提示',
+				cancelText: "继续选择",
+				confirmText: `跟进${data.label}`,
+				content: `继续选择"${data.value[0]}"相关${data.label=='客户'?"项目":"客户"},还是跟进当前选择${data.label}?`,
+				complete: (res) => {
+					if (data.label == '客户') {
+						if (res.confirm) {
+							form.splice(1, 1);
+							that.setData({
+								form,
+								continue1: "sys_enterprise"
+							})
+						}
+						if (res.cancel) {
+							form[1].label = '客户关联项目'
+							form[1].params = {
+								"id": "20221018102003",
+								"content": {
+									"nocache": true,
+									"pageNumber": 1,
+									"pageTotal": 1,
+									sys_enterpriseid: data.value[1][0],
+									"total": null,
+									"type": 1,
+									"where": {
+										"condition": ""
+									}
+								}
+							}
+							that.setData({
+								form,
+								continue1: "sa_project"
+							})
+						}
+					} else {
+						if (res.confirm) {
+							form.splice(0, 1);
+							that.setData({
+								form,
+								continue1: "sa_project"
+							})
+						}
+						if (res.cancel) {
+							form.splice(0, 1);
+							form.splice(1, 0, {
+								label: "项目关联客户",
+								error: false,
+								errMsg: "",
+								type: "route",
+								url: "/packageA/select/setclient/select",
+								radio: true,
+								value: "",
+								params: {
+									"id": "20221027143702",
+									content: {
+										nocache: true,
+										sa_projectid: data.value[1][0],
+										pageNumber: 1,
+										pageTotal: 1,
+										pageSize: 10,
+										total: null,
+										where: {
+											condition: "",
+										}
+									},
+								},
+								placeholder: "选择客户",
+								valueName: "sys_enterprise",
+								checking: "base",
+								required: false
+							});
+							that.setData({
+								form,
+								continue1: "sys_enterprise"
+							})
+						}
+					}
+				}
+			})
+		} else {
+			if (data.valueName != this.data.continue1 && form.length == 3) {
+				form[1].params.sa_projectid = data.value[1][0];
+				form[1].params.sys_enterpriseid = data.value[1][0];
+				form[1].value = "";
+			}
+			this.setData({
+				form
+			})
+		}
+	},
+	/* 获取定位 */
+	getLocation() {
+		let that = this;
+		wx.showLoading({
+			title: '定位中...',
+		});
+		wx.getLocation({
+			type: 'gcj02',
+			isHighAccuracy: true,
+			highAccuracyExpireTime: 8000,
+			success({
+				latitude,
+				longitude
+			}) {
+				wx.hideLoading();
+				that.setData({
+					'markers[0]': {
+						id: 1,
+						latitude,
+						longitude,
+					}
+				});
+				qqmapsdk.reverseGeocoder({
+					location: {
+						latitude,
+						longitude
+					},
+					success(s) {
+						console.log("逆解析", s)
+						that.setData({
+							content: {
+								province: s.result.address_component.province,
+								city: s.result.address_component.city,
+								county: s.result.address_component.district,
+								address: s.result.address,
+								longitude,
+								latitude,
+								remarks: "",
+								ownertable: "",
+								ownerid: ""
+							}
+						})
+					},
+					fail(err) {
+						console.log(err)
+						wx.showToast({
+							title: '定位失败',
+							icon: "none"
+						})
+					}
+				})
+			},
+			fail(err) {
+				console.log(err)
+				wx.showToast({
+					title: '定位失败',
+					icon: "none"
+				})
+			}
+		})
+	},
+	onUnload() {
+		clearInterval(timing)
+	},
+	onReady() {
+
+	},
+})

+ 4 - 0
packageA/clockIn/signIn.json

@@ -0,0 +1,4 @@
+{
+    "usingComponents": {},
+    "navigationBarTitleText": "签到"
+}

+ 87 - 0
packageA/clockIn/signIn.scss

@@ -0,0 +1,87 @@
+.map {
+    width: 100vw;
+    height: 400rpx;
+}
+
+.head {
+    display: flex;
+    width: 100vw;
+    padding: 20rpx 30rpx;
+    background-color: #fff;
+    box-sizing: border-box;
+    border-bottom: 1rpx solid #ddd;
+
+    .main {
+        flex: 1;
+
+        .time {
+            height: 40rpx;
+            line-height: 40rpx;
+            font-size: 28rpx;
+            font-family: PingFang SC-Regular, PingFang SC;
+            color: #333333;
+        }
+
+        .location {
+            margin-top: 10rpx;
+
+            .iconfont {
+                margin-right: 4rpx;
+            }
+
+            line-height: 34rpx;
+            font-size: 24rpx;
+            color: #666666;
+        }
+    }
+
+    navigator {
+        text-align: center;
+        margin-top: 4rpx;
+        color: #666;
+
+        .iconfont {
+            font-size: 40rpx;
+        }
+
+        .font {
+            font-size: 28rpx;
+            margin-top: 6rpx;
+        }
+    }
+
+}
+
+
+
+.footer {
+    display: flex;
+    justify-content: space-between;
+    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-box {
+        .but {
+            min-width: 156rpx;
+            height: 90rpx;
+            background: #3874F6;
+            border-radius: 8rpx;
+            font-size: 28rpx;
+            font-family: PingFang SC-Bold, PingFang SC;
+            font-weight: bold;
+            color: #FFFFFF;
+        }
+
+        .delete {
+            background: var(--warning);
+        }
+    }
+}

+ 25 - 0
packageA/clockIn/signIn.wxml

@@ -0,0 +1,25 @@
+<map class="map" latitude="{{markers[0].latitude}}" longitude="{{markers[0].longitude}}" markers="{{markers}}" scale="17" enable-poi />
+<view class="head">
+    <view class="main">
+        <view class="time">{{time}}</view>
+        <view class="location">
+            <text class="iconfont icon-a-wodemendianxinxidizhi" />{{content.address}}
+        </view>
+    </view>
+    <navigator url="#" bindtap="getLocation">
+        <view class="iconfont icon-tabgenjindongtai" />
+        <view class="font">
+            重新定位
+        </view>
+    </navigator>
+</view>
+<view style="height: 20rpx;" />
+<Yl_field id='Form' form='{{form}}' bind:interrupt="interrupt" />
+
+<view class="footer">
+    <view class="count" />
+    <view class="but-box">
+        <van-button custom-class='but delete' bind:click="rander">重置</van-button>
+        <van-button custom-class='but' bind:click="submit">确定</van-button>
+    </view>
+</view>