Jelajahi Sumber

添加报名二次确认弹窗

wangxin 2 tahun lalu
induk
melakukan
0de980fb38

+ 3 - 0
miniprogram/app.wxs

@@ -8,6 +8,9 @@ function formatMoney(num) {
 }
 // 格式化时间
 function formatTime(date, month_str, minute_str, status) {
+	if(!date){
+		return ''
+	}
   date = date.replace(getRegExp('-', 'g'), '/');
   var _date = null;
   _date = getDate(date);

+ 6 - 0
miniprogram/component/protocolConfirmationView/protocolConfirmationView.json

@@ -0,0 +1,6 @@
+{
+	"component": true,
+	"usingComponents": {
+		"richTextView": "../richTextView/richTextView"
+	}
+}

+ 55 - 0
miniprogram/component/protocolConfirmationView/protocolConfirmationView.scss

@@ -0,0 +1,55 @@
+/* component/protocolConfirmationView.wxss */
+.protocol-confirmation-container {
+	width: 100vw;
+	height: 100vh;
+	background: rgba(0, 0, 0, 0.5);
+	position: fixed;
+	left: 0;
+	top: 0;
+	z-index: 99999;
+	display: flex;
+	align-items: center;
+	justify-content: center;
+
+	.protocol-confirmation-content {
+		width: 640rpx;
+		height: 70vh;
+		background: #FFFFFF;
+		border-radius: 16rpx 16rpx 16rpx 16rpx;
+		padding: 32rpx 0;
+		box-sizing: border-box;
+		display: flex;
+		flex-direction: column;
+		align-items: center;
+		justify-content: space-between;
+
+		.content {
+			width: 100%;
+			height: calc(100% - 96rpx);
+
+			.text-content {
+				padding: 0 32rpx;
+				box-sizing: border-box;
+			}
+		}
+
+		.btn {
+			width: 326rpx;
+			height: 64rpx;
+			font-size: 32rpx;
+			font-family: PingFang SC-Medium, PingFang SC;
+			font-weight: 500;
+			color: #777777;
+			background: #E6E6E6;
+			border-radius: 62rpx 62rpx 62rpx 62rpx;
+			display: flex;
+			align-items: center;
+			justify-content: center;
+		}
+
+		.btn-active {
+			color: #FFFFFF;
+			background: #1A65FF;
+		}
+	}
+}

+ 50 - 0
miniprogram/component/protocolConfirmationView/protocolConfirmationView.ts

@@ -0,0 +1,50 @@
+// component/protocolConfirmationView.ts
+Component({
+
+	/**
+	 * 组件的属性列表
+	 */
+	properties: {
+
+	},
+
+	/**
+	 * 组件的初始数据
+	 */
+	data: {
+		show: false,
+		canSubmit: false,
+		content: '',
+		func: () => { }
+	},
+
+	/**
+	 * 组件的方法列表
+	 */
+	methods: {
+		open(options: { content: string, callback: () => void }) {
+			if (options.content) {
+				this.setData({
+					show: true,
+					func: options.callback,
+					content: options.content
+				})
+			} else {
+				options.callback();
+			}
+		},
+		onScrollToLower() {
+			this.setData({
+				canSubmit: true
+			})
+		},
+		confirm() {
+			if (this.data.canSubmit) {
+				this.data.func && this.data.func()
+				this.setData({
+					show: false
+				})
+			}
+		}
+	}
+})

+ 13 - 0
miniprogram/component/protocolConfirmationView/protocolConfirmationView.wxml

@@ -0,0 +1,13 @@
+<!--component/protocolConfirmationView.wxml-->
+<view wx:if="{{show}}" class="protocol-confirmation-container">
+    <view class="protocol-confirmation-content">
+      <scroll-view scroll-y class="content" bindscrolltolower="onScrollToLower">
+        <view class="text-content">
+          <richTextView text="{{content}}" />
+        </view>
+      </scroll-view>
+      <view class="btn {{canSubmit?'btn-active':''}}" bind:tap="confirm">
+        同意并确认报名
+      </view>
+    </view>
+  </view>

+ 4 - 0
miniprogram/component/richTextView/richTextView.json

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

+ 1 - 0
miniprogram/component/richTextView/richTextView.scss

@@ -0,0 +1 @@
+/* component/richTextView/richTextView.wxss */

+ 54 - 0
miniprogram/component/richTextView/richTextView.ts

@@ -0,0 +1,54 @@
+// component/richTextView/richTextView.ts
+Component({
+
+	/**
+	 * 组件的属性列表
+	 */
+	properties: {
+		text: {
+			type: String,
+			value: ''
+		}
+	},
+	observers: {
+		text: function (value: string) {
+			if (value) {
+				const videoArr: (string | null)[] = []
+				const contentArr: string[] = []
+				// 同步解决如果图片太大超出手机显示界面的问题
+				const nodes = value.replace(/<blockquote/g, "<blockquote style=\"width:100%;background-color: #f5f2f0;border-left: 8px solid #B4D5FF;display: block;font-size: 100%;line-height: 1.5;margin: 10px 0;padding: 10px;box-sizing: border-box;\"").replace(/<hr\/>/g, "<div style=\"border-radius: 3px;margin: 20px auto;padding: 20px 10px;\"><hr style=\"background-color:#ccc;border: 0;display: block;height: 1px;\"/></div>").replace(/<img [^>]*style=['"]*([^'"]+)[^/>]*/g, (match) => {
+					return match.replace(/ style=['"]([^'"]+)*/g, " style=\"$1max-width:100%;height:auto;");
+				});
+				const arr = nodes.split("</video>");
+				const reg = /<video([\s\S]*)/g;
+				for (const i in arr) {
+					const item = arr[i];
+					const urlMatch = item.match(/<video[\s\S]*src="(.*?)"/);
+					if (urlMatch && urlMatch.length > 1) {
+						videoArr[i] = urlMatch[1];
+					} else {
+						videoArr[i] = null;
+					}
+					contentArr[i] = item.replace(reg, "");
+				}
+				this.setData({
+					videoArr,
+					contentArr
+				})
+			}
+		}
+	},
+	/**
+	 * 组件的初始数据
+	 */
+	data: {
+
+	},
+
+	/**
+	 * 组件的方法列表
+	 */
+	methods: {
+
+	}
+})

+ 12 - 0
miniprogram/component/richTextView/richTextView.wxml

@@ -0,0 +1,12 @@
+<!--component/richTextView/richTextView.wxml-->
+<view class="rich-text-view" wx:if="{{contentArr}}">
+    <block wx:for="{{contentArr}}" wx:key="index">
+      <rich-text nodes="{{item}}" />
+      <video
+      	wx:if="{{videoArr[index] !== null}}"
+        wx:key="{{'video' + index}}"
+        show-fullscreen-btn="{{false}}"
+        src="{{videoArr[index]}}"
+      />
+    </block>
+  </view>

+ 6 - 6
miniprogram/config.ts

@@ -7,14 +7,14 @@
  * @FilePath: \Mina_B_T\miniprogram\config.ts
  */
 // 测试服
-// export const apiUrl = "https://hw.hap-job.com/happy-boot"
-// export const baseurl = "https://hw.hap-job.com"
-// export const captcha = '2072736870'
+export const apiUrl = "https://hw.hap-job.com/happy-boot"
+export const baseurl = "https://hw.hap-job.com"
+export const captcha = '2072736870'
 // export const imgServerUrl = "https://hpjobtest.oss-cn-shanghai.aliyuncs.com/uploadfiles/mina"//图片服务器地址
 // export const imgServerUrl_new = "https://hpjobtest.oss-cn-shanghai.aliyuncs.com"//图片服务器地址
 // 正式服
-export const apiUrl = "https://www.dal-pay.com/happy-boot"
-export const baseurl = "https://www.dal-pay.com"
-export const captcha = '2012155849'
+// export const apiUrl = "https://www.dal-pay.com/happy-boot"
+// export const baseurl = "https://www.dal-pay.com"
+// export const captcha = '2012155849'
 // export const imgServerUrl = "https://happyjob.oss-cn-shanghai.aliyuncs.com/uploadfiles/mina"//图片服务器地址
 // export const imgServerUrl_new = "https://happyjob.oss-cn-shanghai.aliyuncs.com"//图片服务器地址

+ 3 - 1
miniprogram/pages/detail/detail.json

@@ -1,4 +1,6 @@
 {
   "navigationBarTitleText": "需求详情",
-  "usingComponents": {}
+  "usingComponents": {
+		"protocolConfirmationView": "/component/protocolConfirmationView/protocolConfirmationView"
+	}
 }

+ 29 - 24
miniprogram/pages/detail/detail.ts

@@ -22,7 +22,7 @@ import { putStorageSync, getStorageSync } from '../../utils/util'
 // }
 import { cancelEnrollmentImpl, getRequirementDetailImpl } from '../../service/impl/hwRequirement.impl'
 // import { cancelEnrollmentImpl, enrollmentRequireImpl, getRequirementDetailImpl } from '../../service/impl/hwRequirement.impl'
-import { confirmOrderImpl, getOrderDetailImpl, confirmECOrdersImpl} from '../../service/impl/hwOrder.impl'
+import { confirmOrderImpl, getOrderDetailImpl, confirmECOrdersImpl } from '../../service/impl/hwOrder.impl'
 import { getHwUserInfo } from '../../utils/util'
 Page({
 
@@ -50,6 +50,7 @@ Page({
 		hwOrderAPI: {
 			workContractType: -1,
 			workContract: '',
+			otherAgreement: '',
 			id: 0,
 			status: -1
 		},
@@ -252,31 +253,35 @@ Page({
 	 */
 	buttonSubmit() {
 		const workContractType = this.data.hwOrderAPI.workContractType;
+		const otherAgreement = this.data.hwOrderAPI.otherAgreement;
 		if (this.data.userInfo.authenticationStatus === 1) {
+			this.selectComponent('.protocolConfirmationView').open({
+				content: otherAgreement, callback: () => {
+					// 电子合同确认订单
+					workContractType === 1 && confirmECOrdersImpl({
+						orderId: this.data.hwOrderAPI.id
+					}).then(res => {
+						wx.openEmbeddedMiniProgram({
+							appId: 'wxa023b292fd19d41d',
+							path: "/" + res.data.url
+						});
+					})
 
-			// 电子合同确认订单
-			workContractType === 1 && confirmECOrdersImpl({
-				orderId: this.data.hwOrderAPI.id
-			}).then(res => {
-				wx.openEmbeddedMiniProgram({
-					appId: 'wxa023b292fd19d41d',
-					path: "/" + res.data.url
-				});
-			})
-
-			// 非电子合同
-			workContractType === 0 && confirmOrderImpl({
-				orderId: this.data.hwOrderAPI.id
-			}).then(res => {
-				if (res.errCode === 0) {
-					wx.showToast({
-						title: '订单已确认',
-						success: () => {
-							// 确认成功后 更改按钮状态
-							const hwOrderAPI = this.data.hwOrderAPI;
-							hwOrderAPI.status = 2;
-							this.setData({
-								hwOrderAPI
+					// 非电子合同
+					workContractType === 0 && confirmOrderImpl({
+						orderId: this.data.hwOrderAPI.id
+					}).then(res => {
+						if (res.errCode === 0) {
+							wx.showToast({
+								title: '订单已确认',
+								success: () => {
+									// 确认成功后 更改按钮状态
+									const hwOrderAPI = this.data.hwOrderAPI;
+									hwOrderAPI.status = 2;
+									this.setData({
+										hwOrderAPI
+									})
+								}
 							})
 						}
 					})

+ 2 - 1
miniprogram/pages/detail/detail.wxml

@@ -190,4 +190,5 @@
 			<view class="button-content disabled" wx:if="{{hwOrderAPI.status === 1}}">订单已完成</view>
 		</block>
 	</view>
-</view>
+</view>
+<protocolConfirmationView class="protocolConfirmationView"></protocolConfirmationView>

+ 2 - 1
miniprogram/pages/my-order/my-order.json

@@ -2,6 +2,7 @@
   "navigationBarTitleText": "我的订单",
   "enablePullDownRefresh": true,
   "usingComponents": {
-    "empty": "/component/empty/empty"
+		"empty": "/component/empty/empty",
+		"protocolConfirmationView": "/component/protocolConfirmationView/protocolConfirmationView"
   }
 }

+ 28 - 24
miniprogram/pages/my-order/my-order.ts

@@ -68,32 +68,36 @@ Page({
 		const id = e.currentTarget.dataset.id;
 		// const index = e.currentTarget.dataset.index;
 		const workContractType = e.currentTarget.dataset.workcontracttype;
+		const otherAgreement = e.currentTarget.dataset.otherAgreement;
 		// const parentindex = e.currentTarget.dataset.parentindex;
-
 		if (this.data.userInfo.authenticationStatus === 1) {
-			// 电子合同确认
-			workContractType === 1 && confirmECOrdersImpl({
-				orderId: id
-			}).then(data => {
-				wx.openEmbeddedMiniProgram({
-					appId: 'wxa023b292fd19d41d',
-					path: "/" + data.data.url,
-				});
-			})
-			// 非电子合同确认
-			workContractType === 0 && confirmOrderImpl({
-				orderId: id
-			}).then(res => {
-				if (res.errCode === 0) {
-					workContractType === 0 && wx.showToast({
-						title: '订单已确认',
-						success: () => {
-							// 确认成功  更改页面订单状态
-							this.getList()
-							// this.setData({
-							//   [`list[${parentindex}][${index}].status`]: 2,
-							//   // [`list[${parentindex}][${index}].serviceStage`]: 2,
-							// })
+			this.selectComponent('.protocolConfirmationView').open({
+				content: otherAgreement, callback: () => {
+					// 电子合同确认
+					workContractType === 1 && confirmECOrdersImpl({
+						orderId: id
+					}).then(data => {
+						wx.openEmbeddedMiniProgram({
+							appId: 'wxa023b292fd19d41d',
+							path: "/" + data.data.url,
+						});
+					})
+					// 非电子合同确认
+					workContractType === 0 && confirmOrderImpl({
+						orderId: id
+					}).then(res => {
+						if (res.errCode === 0) {
+							workContractType === 0 && wx.showToast({
+								title: '订单已确认',
+								success: () => {
+									// 确认成功  更改页面订单状态
+									this.getList()
+									// this.setData({
+									//   [`list[${parentindex}][${index}].status`]: 2,
+									//   // [`list[${parentindex}][${index}].serviceStage`]: 2,
+									// })
+								}
+							})
 						}
 					})
 				}

+ 2 - 1
miniprogram/pages/my-order/my-order.wxml

@@ -39,7 +39,7 @@
           </view>
           <view class="order-info">
             <text>订单号: {{item.orderNumber}}</text>
-            <view class="button-confirm" wx:if="{{status === 0}}" data-id="{{item.id}}" data-parentIndex="{{key}}"
+            <view class="button-confirm" wx:if="{{status === 0}}" data-id="{{item.id}}" data-otherAgreement="{{item.otherAgreement}}" data-parentIndex="{{key}}"
               data-index="{{index}}" data-workContractType="{{item.workContractType}}" catchtap="confirm">确认签署</view>
             <text class="doing" wx:if="{{status === 2}}">进行中</text>
             <text class="done" wx:if="{{status === 1}}">已完成</text>
@@ -57,3 +57,4 @@
     <view class="offline-reload" bindtap="reload">重新加载</view>
   </view>
 </view>
+<protocolConfirmationView class="protocolConfirmationView"></protocolConfirmationView>

+ 1 - 1
project.config.json

@@ -52,7 +52,7 @@
 		"tabIndent": "tab",
 		"tabSize": 2
 	},
-	"appid": "wxb0f8f3f0de6e8f07",
+	"appid": "wx997164f2857c1a1d",
 	"packOptions": {
 		"ignore": [],
 		"include": []