From 99eb82d94843caa48ca38582bca2d7275c59809c Mon Sep 17 00:00:00 2001
From: pang.jiabao <pang_jiabao@163.com>
Date: 星期五, 07 三月 2025 10:34:01 +0800
Subject: [PATCH] 组托提交后清除订单号
---
uni_modules/uni-swipe-action/components/uni-swipe-action-item/render.js | 530 +++++++++++++++++++++++++++++-----------------------------
1 files changed, 265 insertions(+), 265 deletions(-)
diff --git a/uni_modules/uni-swipe-action/components/uni-swipe-action-item/render.js b/uni_modules/uni-swipe-action/components/uni-swipe-action-item/render.js
index abaa54d..ac50d75 100644
--- a/uni_modules/uni-swipe-action/components/uni-swipe-action-item/render.js
+++ b/uni_modules/uni-swipe-action/components/uni-swipe-action-item/render.js
@@ -1,265 +1,265 @@
-const MIN_DISTANCE = 10;
-export default {
- showWatch(newVal, oldVal, ownerInstance, instance,self) {
- let state = self.state
- this.getDom(instance, ownerInstance,self)
- if (newVal && newVal !== 'none') {
- this.openState(newVal, instance, ownerInstance,self)
- return
- }
-
- if (state.left) {
- this.openState('none', instance, ownerInstance,self)
- }
- this.resetTouchStatus(instance,self)
- },
-
- /**
- * 寮�濮嬭Е鎽告搷浣�
- * @param {Object} e
- * @param {Object} ins
- */
- touchstart(e, ownerInstance, self) {
- let instance = e.instance;
- let disabled = instance.getDataset().disabled
- let state = self.state;
- this.getDom(instance, ownerInstance, self)
- // fix by mehaotian, TODO 鍏煎 app-vue 鑾峰彇dataset涓哄瓧绗︿覆 , h5 鑾峰彇 涓� undefined 鐨勯棶棰�,寰呮鏋朵慨澶�
- disabled = this.getDisabledType(disabled)
- if (disabled) return
- // 寮�濮嬭Е鎽告椂绉婚櫎鍔ㄧ敾绫�
- instance.requestAnimationFrame(function() {
- instance.removeClass('ani');
- ownerInstance.callMethod('closeSwipe');
- })
-
- // 璁板綍涓婃鐨勪綅缃�
- state.x = state.left || 0
- // 璁$畻婊戝姩寮�濮嬩綅缃�
- this.stopTouchStart(e, ownerInstance, self)
- },
-
- /**
- * 寮�濮嬫粦鍔ㄦ搷浣�
- * @param {Object} e
- * @param {Object} ownerInstance
- */
- touchmove(e, ownerInstance, self) {
- let instance = e.instance;
- let disabled = instance.getDataset().disabled
- let state = self.state
- // fix by mehaotian, TODO 鍏煎 app-vue 鑾峰彇dataset涓哄瓧绗︿覆 , h5 鑾峰彇 涓� undefined 鐨勯棶棰�,寰呮鏋朵慨澶�
- disabled = this.getDisabledType(disabled)
- if (disabled) return
- // 鏄惁鍙互婊戝姩椤甸潰
- this.stopTouchMove(e, self);
- if (state.direction !== 'horizontal') {
- return;
- }
- if (e.preventDefault) {
- // 闃绘椤甸潰婊氬姩
- e.preventDefault()
- }
- let x = state.x + state.deltaX
- this.move(x, instance, ownerInstance, self)
- },
-
- /**
- * 缁撴潫瑙︽懜鎿嶄綔
- * @param {Object} e
- * @param {Object} ownerInstance
- */
- touchend(e, ownerInstance, self) {
- let instance = e.instance;
- let disabled = instance.getDataset().disabled
- let state = self.state
- // fix by mehaotian, TODO 鍏煎 app-vue 鑾峰彇dataset涓哄瓧绗︿覆 , h5 鑾峰彇 涓� undefined 鐨勯棶棰�,寰呮鏋朵慨澶�
- disabled = this.getDisabledType(disabled)
-
- if (disabled) return
- // 婊戝姩杩囩▼涓Е鎽哥粨鏉�,閫氳繃闃欏�煎垽鏂槸寮�鍚繕鏄叧闂�
- // fixed by mehaotian 瀹氭椂鍣ㄨВ鍐崇偣鍑绘寜閽紝touchend 瑙﹀彂姣� click 浜嬩欢鏃舵満鏃╃殑闂 锛屼富瑕佹槸 ios13
- this.moveDirection(state.left, instance, ownerInstance, self)
-
- },
-
- /**
- * 璁剧疆绉诲姩璺濈
- * @param {Object} value
- * @param {Object} instance
- * @param {Object} ownerInstance
- */
- move(value, instance, ownerInstance, self) {
- value = value || 0
- let state = self.state
- let leftWidth = state.leftWidth
- let rightWidth = state.rightWidth
- // 鑾峰彇鍙粦鍔ㄨ寖鍥�
- state.left = this.range(value, -rightWidth, leftWidth);
- instance.requestAnimationFrame(function() {
- instance.setStyle({
- transform: 'translateX(' + state.left + 'px)',
- '-webkit-transform': 'translateX(' + state.left + 'px)'
- })
- })
-
- },
-
- /**
- * 鑾峰彇鍏冪礌淇℃伅
- * @param {Object} instance
- * @param {Object} ownerInstance
- */
- getDom(instance, ownerInstance, self) {
- let state = self.state
- var leftDom = ownerInstance.$el.querySelector('.button-group--left')
- var rightDom = ownerInstance.$el.querySelector('.button-group--right')
-
- state.leftWidth = leftDom.offsetWidth || 0
- state.rightWidth = rightDom.offsetWidth || 0
- state.threshold = instance.getDataset().threshold
- },
-
- getDisabledType(value) {
- return (typeof(value) === 'string' ? JSON.parse(value) : value) || false;
- },
-
- /**
- * 鑾峰彇鑼冨洿
- * @param {Object} num
- * @param {Object} min
- * @param {Object} max
- */
- range(num, min, max) {
- return Math.min(Math.max(num, min), max);
- },
-
-
- /**
- * 绉诲姩鏂瑰悜鍒ゆ柇
- * @param {Object} left
- * @param {Object} value
- * @param {Object} ownerInstance
- * @param {Object} ins
- */
- moveDirection(left, ins, ownerInstance, self) {
- var state = self.state
- var threshold = state.threshold
- var position = state.position
- var isopen = state.isopen || 'none'
- var leftWidth = state.leftWidth
- var rightWidth = state.rightWidth
- if (state.deltaX === 0) {
- this.openState('none', ins, ownerInstance, self)
- return
- }
- if ((isopen === 'none' && rightWidth > 0 && -left > threshold) || (isopen !== 'none' && rightWidth > 0 &&
- rightWidth +
- left < threshold)) {
- // right
- this.openState('right', ins, ownerInstance, self)
- } else if ((isopen === 'none' && leftWidth > 0 && left > threshold) || (isopen !== 'none' && leftWidth > 0 &&
- leftWidth - left < threshold)) {
- // left
- this.openState('left', ins, ownerInstance, self)
- } else {
- // default
- this.openState('none', ins, ownerInstance, self)
- }
- },
-
-
- /**
- * 寮�鍚姸鎬�
- * @param {Boolean} type
- * @param {Object} ins
- * @param {Object} ownerInstance
- */
- openState(type, ins, ownerInstance, self) {
- let state = self.state
- let leftWidth = state.leftWidth
- let rightWidth = state.rightWidth
- let left = ''
- state.isopen = state.isopen ? state.isopen : 'none'
- switch (type) {
- case "left":
- left = leftWidth
- break
- case "right":
- left = -rightWidth
- break
- default:
- left = 0
- }
-
- // && !state.throttle
-
- if (state.isopen !== type) {
- state.throttle = true
- ownerInstance.callMethod('change', {
- open: type
- })
-
- }
-
- state.isopen = type
- // 娣诲姞鍔ㄧ敾绫�
- ins.requestAnimationFrame(()=> {
- ins.addClass('ani');
- this.move(left, ins, ownerInstance, self)
- })
- },
-
-
- getDirection(x, y) {
- if (x > y && x > MIN_DISTANCE) {
- return 'horizontal';
- }
- if (y > x && y > MIN_DISTANCE) {
- return 'vertical';
- }
- return '';
- },
-
- /**
- * 閲嶇疆婊戝姩鐘舵��
- * @param {Object} event
- */
- resetTouchStatus(instance, self) {
- let state = self.state;
- state.direction = '';
- state.deltaX = 0;
- state.deltaY = 0;
- state.offsetX = 0;
- state.offsetY = 0;
- },
-
- /**
- * 璁剧疆婊戝姩寮�濮嬩綅缃�
- * @param {Object} event
- */
- stopTouchStart(event, ownerInstance, self) {
- let instance = event.instance;
- let state = self.state
- this.resetTouchStatus(instance, self);
- var touch = event.touches[0];
- state.startX = touch.clientX;
- state.startY = touch.clientY;
- },
-
- /**
- * 婊戝姩涓紝鏄惁绂佹鎵撳紑
- * @param {Object} event
- */
- stopTouchMove(event, self) {
- let instance = event.instance;
- let state = self.state;
- let touch = event.touches[0];
-
- state.deltaX = touch.clientX - state.startX;
- state.deltaY = touch.clientY - state.startY;
- state.offsetY = Math.abs(state.deltaY);
- state.offsetX = Math.abs(state.deltaX);
- state.direction = state.direction || this.getDirection(state.offsetX, state.offsetY);
- }
-}
+const MIN_DISTANCE = 10;
+export default {
+ showWatch(newVal, oldVal, ownerInstance, instance,self) {
+ let state = self.state
+ this.getDom(instance, ownerInstance,self)
+ if (newVal && newVal !== 'none') {
+ this.openState(newVal, instance, ownerInstance,self)
+ return
+ }
+
+ if (state.left) {
+ this.openState('none', instance, ownerInstance,self)
+ }
+ this.resetTouchStatus(instance,self)
+ },
+
+ /**
+ * 寮�濮嬭Е鎽告搷浣�
+ * @param {Object} e
+ * @param {Object} ins
+ */
+ touchstart(e, ownerInstance, self) {
+ let instance = e.instance;
+ let disabled = instance.getDataset().disabled
+ let state = self.state;
+ this.getDom(instance, ownerInstance, self)
+ // fix by mehaotian, TODO 鍏煎 app-vue 鑾峰彇dataset涓哄瓧绗︿覆 , h5 鑾峰彇 涓� undefined 鐨勯棶棰�,寰呮鏋朵慨澶�
+ disabled = this.getDisabledType(disabled)
+ if (disabled) return
+ // 寮�濮嬭Е鎽告椂绉婚櫎鍔ㄧ敾绫�
+ instance.requestAnimationFrame(function() {
+ instance.removeClass('ani');
+ ownerInstance.callMethod('closeSwipe');
+ })
+
+ // 璁板綍涓婃鐨勪綅缃�
+ state.x = state.left || 0
+ // 璁$畻婊戝姩寮�濮嬩綅缃�
+ this.stopTouchStart(e, ownerInstance, self)
+ },
+
+ /**
+ * 寮�濮嬫粦鍔ㄦ搷浣�
+ * @param {Object} e
+ * @param {Object} ownerInstance
+ */
+ touchmove(e, ownerInstance, self) {
+ let instance = e.instance;
+ let disabled = instance.getDataset().disabled
+ let state = self.state
+ // fix by mehaotian, TODO 鍏煎 app-vue 鑾峰彇dataset涓哄瓧绗︿覆 , h5 鑾峰彇 涓� undefined 鐨勯棶棰�,寰呮鏋朵慨澶�
+ disabled = this.getDisabledType(disabled)
+ if (disabled) return
+ // 鏄惁鍙互婊戝姩椤甸潰
+ this.stopTouchMove(e, self);
+ if (state.direction !== 'horizontal') {
+ return;
+ }
+ if (e.preventDefault) {
+ // 闃绘椤甸潰婊氬姩
+ e.preventDefault()
+ }
+ let x = state.x + state.deltaX
+ this.move(x, instance, ownerInstance, self)
+ },
+
+ /**
+ * 缁撴潫瑙︽懜鎿嶄綔
+ * @param {Object} e
+ * @param {Object} ownerInstance
+ */
+ touchend(e, ownerInstance, self) {
+ let instance = e.instance;
+ let disabled = instance.getDataset().disabled
+ let state = self.state
+ // fix by mehaotian, TODO 鍏煎 app-vue 鑾峰彇dataset涓哄瓧绗︿覆 , h5 鑾峰彇 涓� undefined 鐨勯棶棰�,寰呮鏋朵慨澶�
+ disabled = this.getDisabledType(disabled)
+
+ if (disabled) return
+ // 婊戝姩杩囩▼涓Е鎽哥粨鏉�,閫氳繃闃欏�煎垽鏂槸寮�鍚繕鏄叧闂�
+ // fixed by mehaotian 瀹氭椂鍣ㄨВ鍐崇偣鍑绘寜閽紝touchend 瑙﹀彂姣� click 浜嬩欢鏃舵満鏃╃殑闂 锛屼富瑕佹槸 ios13
+ this.moveDirection(state.left, instance, ownerInstance, self)
+
+ },
+
+ /**
+ * 璁剧疆绉诲姩璺濈
+ * @param {Object} value
+ * @param {Object} instance
+ * @param {Object} ownerInstance
+ */
+ move(value, instance, ownerInstance, self) {
+ value = value || 0
+ let state = self.state
+ let leftWidth = state.leftWidth
+ let rightWidth = state.rightWidth
+ // 鑾峰彇鍙粦鍔ㄨ寖鍥�
+ state.left = this.range(value, -rightWidth, leftWidth);
+ instance.requestAnimationFrame(function() {
+ instance.setStyle({
+ transform: 'translateX(' + state.left + 'px)',
+ '-webkit-transform': 'translateX(' + state.left + 'px)'
+ })
+ })
+
+ },
+
+ /**
+ * 鑾峰彇鍏冪礌淇℃伅
+ * @param {Object} instance
+ * @param {Object} ownerInstance
+ */
+ getDom(instance, ownerInstance, self) {
+ let state = self.state
+ var leftDom = ownerInstance.$el.querySelector('.button-group--left')
+ var rightDom = ownerInstance.$el.querySelector('.button-group--right')
+
+ state.leftWidth = leftDom.offsetWidth || 0
+ state.rightWidth = rightDom.offsetWidth || 0
+ state.threshold = instance.getDataset().threshold
+ },
+
+ getDisabledType(value) {
+ return (typeof(value) === 'string' ? JSON.parse(value) : value) || false;
+ },
+
+ /**
+ * 鑾峰彇鑼冨洿
+ * @param {Object} num
+ * @param {Object} min
+ * @param {Object} max
+ */
+ range(num, min, max) {
+ return Math.min(Math.max(num, min), max);
+ },
+
+
+ /**
+ * 绉诲姩鏂瑰悜鍒ゆ柇
+ * @param {Object} left
+ * @param {Object} value
+ * @param {Object} ownerInstance
+ * @param {Object} ins
+ */
+ moveDirection(left, ins, ownerInstance, self) {
+ var state = self.state
+ var threshold = state.threshold
+ var position = state.position
+ var isopen = state.isopen || 'none'
+ var leftWidth = state.leftWidth
+ var rightWidth = state.rightWidth
+ if (state.deltaX === 0) {
+ this.openState('none', ins, ownerInstance, self)
+ return
+ }
+ if ((isopen === 'none' && rightWidth > 0 && -left > threshold) || (isopen !== 'none' && rightWidth > 0 &&
+ rightWidth +
+ left < threshold)) {
+ // right
+ this.openState('right', ins, ownerInstance, self)
+ } else if ((isopen === 'none' && leftWidth > 0 && left > threshold) || (isopen !== 'none' && leftWidth > 0 &&
+ leftWidth - left < threshold)) {
+ // left
+ this.openState('left', ins, ownerInstance, self)
+ } else {
+ // default
+ this.openState('none', ins, ownerInstance, self)
+ }
+ },
+
+
+ /**
+ * 寮�鍚姸鎬�
+ * @param {Boolean} type
+ * @param {Object} ins
+ * @param {Object} ownerInstance
+ */
+ openState(type, ins, ownerInstance, self) {
+ let state = self.state
+ let leftWidth = state.leftWidth
+ let rightWidth = state.rightWidth
+ let left = ''
+ state.isopen = state.isopen ? state.isopen : 'none'
+ switch (type) {
+ case "left":
+ left = leftWidth
+ break
+ case "right":
+ left = -rightWidth
+ break
+ default:
+ left = 0
+ }
+
+ // && !state.throttle
+
+ if (state.isopen !== type) {
+ state.throttle = true
+ ownerInstance.callMethod('change', {
+ open: type
+ })
+
+ }
+
+ state.isopen = type
+ // 娣诲姞鍔ㄧ敾绫�
+ ins.requestAnimationFrame(()=> {
+ ins.addClass('ani');
+ this.move(left, ins, ownerInstance, self)
+ })
+ },
+
+
+ getDirection(x, y) {
+ if (x > y && x > MIN_DISTANCE) {
+ return 'horizontal';
+ }
+ if (y > x && y > MIN_DISTANCE) {
+ return 'vertical';
+ }
+ return '';
+ },
+
+ /**
+ * 閲嶇疆婊戝姩鐘舵��
+ * @param {Object} event
+ */
+ resetTouchStatus(instance, self) {
+ let state = self.state;
+ state.direction = '';
+ state.deltaX = 0;
+ state.deltaY = 0;
+ state.offsetX = 0;
+ state.offsetY = 0;
+ },
+
+ /**
+ * 璁剧疆婊戝姩寮�濮嬩綅缃�
+ * @param {Object} event
+ */
+ stopTouchStart(event, ownerInstance, self) {
+ let instance = event.instance;
+ let state = self.state
+ this.resetTouchStatus(instance, self);
+ var touch = event.touches[0];
+ state.startX = touch.clientX;
+ state.startY = touch.clientY;
+ },
+
+ /**
+ * 婊戝姩涓紝鏄惁绂佹鎵撳紑
+ * @param {Object} event
+ */
+ stopTouchMove(event, self) {
+ let instance = event.instance;
+ let state = self.state;
+ let touch = event.touches[0];
+
+ state.deltaX = touch.clientX - state.startX;
+ state.deltaY = touch.clientY - state.startY;
+ state.offsetY = Math.abs(state.deltaY);
+ state.offsetX = Math.abs(state.deltaX);
+ state.direction = state.direction || this.getDirection(state.offsetX, state.offsetY);
+ }
+}
--
Gitblit v1.9.1