瀏覽代碼

颜选美学v1.3测试bug修改

yuwenjun1997 2 年之前
父節點
當前提交
7f02baaa25
共有 31 個文件被更改,包括 706 次插入426 次删除
  1. 1 1
      common/couponUtils.js
  2. 15 86
      common/share.helper.js
  3. 1 2
      common/validation.js
  4. 143 142
      components/common/tui-validation/tui-validation.js
  5. 1 1
      components/views/cm-coupon-popup/cm-coupon-popup.vue
  6. 2 1
      components/views/cm-coupon/cm-coupon.vue
  7. 156 110
      components/views/cm-share-popup/cm-share-popup.vue
  8. 1 4
      pages/authorize/login-custom.vue
  9. 4 3
      pages/index/mixins/share-entry.js
  10. 8 2
      pages/tabBar/home/home.vue
  11. 9 6
      pages/views/activity/activity-detail.vue
  12. 75 0
      pages/views/goods/commons/helper.js
  13. 4 0
      pages/views/goods/components/goods-coupon-list/goods-coupon-list.vue
  14. 4 0
      pages/views/goods/components/goods-coupon-section/goods-coupon-section.vue
  15. 1 11
      pages/views/goods/components/goods-price/goods-price.vue
  16. 20 3
      pages/views/goods/components/goods-receive-buy-popup/goods-receive-buy-popup.vue
  17. 42 24
      pages/views/goods/goods-detail.vue
  18. 1 1
      pages/views/goods/goods-list.vue
  19. 2 2
      pages/views/goods/goods-search.vue
  20. 2 2
      pages/views/order/components/order-product/order-product.vue
  21. 18 1
      pages/views/order/order-create.vue
  22. 17 3
      pages/views/order/order-pay.vue
  23. 2 2
      pages/views/order/pay-faild.vue
  24. 4 4
      pages/views/order/pay-success.vue
  25. 24 3
      pages/views/others/join-us.vue
  26. 70 4
      pages/views/share-buy/share-buy-detail.vue
  27. 46 1
      pages/views/share-buy/share-buy-success.vue
  28. 10 1
      services/api/auth.js
  29. 8 1
      services/api/common.js
  30. 8 1
      store/modules/cart.js
  31. 7 4
      store/modules/coupon.js

+ 1 - 1
common/couponUtils.js

@@ -84,7 +84,7 @@ class CouponUtils {
 
     // 统计商品价格
     totalProductPrice(product) {
-        return product.price * product.productCount
+        return product.price * product.num
     }
 
     // 排序

+ 15 - 86
common/share.helper.js

@@ -1,6 +1,7 @@
 import { encrypt } from '@/common/crypto.js'
 /* 小程序码 */
 import store from '@/store/index.js'
+import { wxUnlimited } from '@/services/api/auth.js'
 const fs = uni.getFileSystemManager()
 const qrcodePath = `${wx.env.USER_DATA_PATH}/qrcodePath`
 
@@ -28,6 +29,7 @@ const queryKeyOfMap = {
     'keyWord': 'k',
     'productId': 'p',
     'jumpState': 'j',
+    'collageId': 'c'
 }
 
 const enQueryKeyOfMap = {
@@ -38,112 +40,39 @@ const enQueryKeyOfMap = {
     'k': 'keyWord',
     'p': 'productId',
     'j': 'jumpState',
+    'c': 'collageId'
 }
 
 // 创建二维码保存路径
 function createQrcodeDir(callback) {
     try {
         fs.accessSync(qrcodePath)
-        console.log('已存在文件夹');
+        console.log('已存在文件夹')
         callback(qrcodePath)
     } catch (e) {
         fs.mkdirSync(qrcodePath)
-        console.log('不存在文件夹');
+        console.log('不存在文件夹')
         callback(qrcodePath)
     }
 }
 
-/* 保存图片为临时路径 */
-function saveFileToTempFilePath(options = {}) {
-    return new Promise((resolve, reject) => {
-        // 调用创建文件夹Api
-        createQrcodeDir(qrcodePath => {
-            // 拼接二维码保存路径
-            qrcodePath = qrcodePath + '/' + options.fileName
-            // 写入文件到本地文件夹
-            fs.writeFile({
-                filePath: qrcodePath,
-                data: options.qrcodeArrayBuffer,
-                encoding: options.encoding || 'base64',
-                success(res) {
-                    if (qrcodePath.startsWith('wxfile')) {
-                        resolve({
-                            tempFilePath: qrcodePath
-                        })
-                    } else {
-                        // 获取本地文件临时路径
-                        uni.downloadFile({
-                            url: qrcodePath,
-                            success(res) {
-                                console.log('获取本地文件临时路径', qrcodePath);
-                                console.log(res)
-                                resolve(res)
-                            },
-                            fail(error) {
-                                console.log('获取本地文件临时路径', qrcodePath);
-                                console.log(error)
-                                reject(error)
-                            }
-                        })
-                    }
-                },
-                fail(error) {
-                    console.log(error)
-                    reject(error)
-                }
-            })
-        })
-    })
-}
-
-// 请求二维码
-function requestWxUnlimited(params) {
-    return new Promise((resolve, reject) => {
-        // 发起http请求
-        uni.request({
-            url: `https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=${params.access_token}`,
-            method: 'POST',
-            responseType: 'arraybuffer',
-            data: {
-                page: params.pagePath || 'pages/index/index',
-                scene: params.queryStr,
-                check_path: process.env.NODE_ENV === 'production', // 是否校验页面
-                env_version: process.env.NODE_ENV === 'production' ? "release" :
-                'develop', // 正式版 or 开发版
-                width: 200, // 二维码宽度
-                auto_color: false, // 自动颜色
-                line_color: { "r": 0, "g": 0, "b": 0 }, // 线条颜色
-                is_hyaline: true // 透明底
-            },
-            success(data) {
-                console.log('二维码');
-                console.log(data)
-                resolve(data)
-            },
-            fail(error) {
-                reject(error)
-            }
-        })
-    })
-}
 
 /* 生成二维码链接 */
 export async function generateWxUnlimited(params) {
     try {
         // 从服务端获取二维码arrayBuffer
-        const { data: qrcodeArrayBuffer } = await requestWxUnlimited({
-            access_token: store.getters.accessToken,
-            queryStr: codeQueryStr(params.queryStr) // 编码成字符更少的参数
-        })
-        // 将arrayBuffer转为文件并返回TempFilePath
-        const result = await saveFileToTempFilePath({
-            fileName: 'share-qrcode.png',
-            qrcodeArrayBuffer
+        return await wxUnlimited({
+            page: params.pagePath || 'pages/index/index',
+            scene: codeQueryStr(params.queryStr),
+            check_path: process.env.NODE_ENV === 'production', // 是否校验页面
+            env_version: process.env.NODE_ENV === 'production' ? 'release' : 'trial', // 正式版 or 开发版
+            width: 200, // 二维码宽度
+            auto_color: false, // 自动颜色
+            line_color: { 'r': 0, 'g': 0, 'b': 0 }, // 线条颜色
+            is_hyaline: true // 透明底
         })
-        return result
     } catch (e) {
-        debugger
-        return e
+        return Promise.reject(e)
     }
 }
 

+ 1 - 2
common/validation.js

@@ -64,8 +64,7 @@ export function validEmail(email) {
  * @returns {Boolean}
  */
 export function validMobile(mobile) {
-	const reg = /^(13[0-9]|14[5|7]|15[0|1|2|3|4|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\d{8}$/
-	return reg.test(mobile)
+	return /^1[23456789]\d{9}$/.test(mobile)
 }
 
 /**

+ 143 - 142
components/common/tui-validation/tui-validation.js

@@ -17,220 +17,221 @@ const form = {
 	*/
 	validation: function(formData, rules) {
 		for (let item of rules) {
-			let key = item.name;
-			let rule = item.rule;
-			let validator = item.validator;
-			let msgArr = item.msg;
+			let key = item.name
+			let rule = item.rule
+			let validator = item.validator
+			let msgArr = item.msg
 			if (!key || !rule || rule.length === 0 || !msgArr || msgArr.length === 0 || (!~rule.indexOf(
-						"required") && formData[key].toString()
+						'required') && formData[key].toString()
 					.length === 0)) {
-				continue;
+				continue
 			}
 			for (let i = 0, length = rule.length; i < length; i++) {
-				let ruleItem = rule[i];
-				let msg = msgArr[i];
-				if (!msg || !ruleItem) continue;
+				let ruleItem = rule[i]
+				let msg = msgArr[i]
+				if (!msg || !ruleItem) continue
 				//数据处理
-				let value = null;
-				if (~ruleItem.indexOf(":")) {
-					let temp = ruleItem.split(":");
-					ruleItem = temp[0];
-					value = temp[1];
+				let value = null
+				if (~ruleItem.indexOf(':')) {
+					let temp = ruleItem.split(':')
+					ruleItem = temp[0]
+					value = temp[1]
 				}
-				let isError = false;
+				let isError = false
 				switch (ruleItem) {
-					case "required":
-						isError = form._isNullOrEmpty(formData[key]);
-						break;
-					case "isMobile":
-						isError = !form._isMobile(formData[key]);
-						break;
-					case "isEmail":
-						isError = !form._isEmail(formData[key]);
-						break;
-					case "isCarNo":
-						isError = !form._isCarNo(formData[key]);
-						break;
-					case "isIdCard":
-						isError = !form._isIdCard(formData[key]);
-						break;
-					case "isAmount":
-						isError = !form._isAmount(formData[key]);
-						break;
-					case "isNum":
-						isError = !form._isNum(formData[key]);
-						break;
-					case "isChinese":
-						isError = !form._isChinese(formData[key]);
-						break;
-					case "isNotChinese":
-						isError = !form._isNotChinese(formData[key]);
-						break;
-					case "isEnglish":
-						isError = !form._isEnglish(formData[key]);
-						break;
-					case "isEnAndNo":
-						isError = !form._isEnAndNo(formData[key]);
-						break;
-					case "isEnOrNo":
-						isError = !form._isEnOrNo(formData[key]);
-						break;
-					case "isSpecial":
-						isError = form._isSpecial(formData[key]);
-						break;
-					case "isEmoji":
-						isError = form._isEmoji(formData[key]);
-						break;
-					case "isDate":
-						isError = !form._isDate(formData[key]);
-						break;
-					case "isUrl":
-						isError = !form._isUrl(formData[key]);
-						break;
-					case "isSame":
-						isError = !form._isSame(formData[key], formData[value]);
-						break;
-					case "range":
-						let range = null;
+					case 'required':
+						isError = form._isNullOrEmpty(formData[key])
+						break
+					case 'isMobile':
+						isError = !form._isMobile(formData[key])
+						break
+					case 'isEmail':
+						isError = !form._isEmail(formData[key])
+						break
+					case 'isCarNo':
+						isError = !form._isCarNo(formData[key])
+						break
+					case 'isIdCard':
+						isError = !form._isIdCard(formData[key])
+						break
+					case 'isAmount':
+						isError = !form._isAmount(formData[key])
+						break
+					case 'isNum':
+						isError = !form._isNum(formData[key])
+						break
+					case 'isChinese':
+						isError = !form._isChinese(formData[key])
+						break
+					case 'isNotChinese':
+						isError = !form._isNotChinese(formData[key])
+						break
+					case 'isEnglish':
+						isError = !form._isEnglish(formData[key])
+						break
+					case 'isEnAndNo':
+						isError = !form._isEnAndNo(formData[key])
+						break
+					case 'isEnOrNo':
+						isError = !form._isEnOrNo(formData[key])
+						break
+					case 'isSpecial':
+						isError = form._isSpecial(formData[key])
+						break
+					case 'isEmoji':
+						isError = form._isEmoji(formData[key])
+						break
+					case 'isDate':
+						isError = !form._isDate(formData[key])
+						break
+					case 'isUrl':
+						isError = !form._isUrl(formData[key])
+						break
+					case 'isSame':
+						isError = !form._isSame(formData[key], formData[value])
+						break
+					case 'range':
+						let range = null
 						try {
-							range = JSON.parse(value);
+							range = JSON.parse(value)
 							if (range.length <= 1) {
-								throw new Error("range值传入有误!")
+								throw new Error('range值传入有误!')
 							}
 						} catch (e) {
-							return "range值传入有误!"
+							return 'range值传入有误!'
 						}
 						isError = !form._isRange(formData[key], range[0], range[1])
-						break;
-					case "minLength":
+						break
+					case 'minLength':
 						isError = !form._minLength(formData[key], value)
-						break;
-					case "maxLength":
+						break
+					case 'maxLength':
 						isError = !form._maxLength(formData[key], value)
-						break;
-					case "isKeyword":
+						break
+					case 'isKeyword':
 						isError = !form._isKeyword(formData[key], value)
-						break;
+						break
 					default:
-						break;
+						break
 				}
 
 				if (isError) {
-					return msg;
+					return msg
 				}
 			}
 			if (validator && validator.length > 0) {
 				for (let model of validator) {
-					let func = model.method;
+					let func = model.method
 					if (func && !func(formData[key])) {
-						return model.msg;
+						return model.msg
 					}
 				}
 			}
 		}
-		return "";
+		return ''
 	},
 	//允许填写字符串null或者undefined
 	_isNullOrEmpty: function(value) {
-		return (value === null || value === '' || value === undefined) ? true : false;
+		return (value === null || value === '' || value === undefined) ? true : false
 	},
 	_isMobile: function(value) {
-		return /^(?:13\d|14\d|15\d|16\d|17\d|18\d|19\d)\d{5}(\d{3}|\*{3})$/.test(value);
+		// return /^(?:13\d|14\d|15\d|16\d|17\d|18\d|19\d)\d{5}(\d{3}|\*{3})$/.test(value);
+        return /^1[23456789]\d{9}$/.test(value)
 	},
 	_isEmail: function(value) {
-		return /^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/.test(value);
+		return /^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/.test(value)
 	},
 	_isCarNo: function(value) {
 		// 新能源车牌
 		const xreg =
-			/^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}(([0-9]{5}[DF]$)|([DF][A-HJ-NP-Z0-9][0-9]{4}$))/;
+			/^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}(([0-9]{5}[DF]$)|([DF][A-HJ-NP-Z0-9][0-9]{4}$))/
 		// 旧车牌
 		const creg =
-			/^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]{1}$/;
+			/^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]{1}$/
 		if (value.length === 7) {
-			return creg.test(value);
+			return creg.test(value)
 		} else if (value.length === 8) {
-			return xreg.test(value);
+			return xreg.test(value)
 		} else {
-			return false;
+			return false
 		}
 	},
 	_isIdCard: function(value) {
-		let idCard = value;
+		let idCard = value
 		if (idCard.length == 15) {
-			return this.__isValidityBrithBy15IdCard;
+			return this.__isValidityBrithBy15IdCard
 		} else if (idCard.length == 18) {
-			let arrIdCard = idCard.split("");
+			let arrIdCard = idCard.split('')
 			if (this.__isValidityBrithBy18IdCard(idCard) && this.__isTrueValidateCodeBy18IdCard(arrIdCard)) {
-				return true;
+				return true
 			} else {
-				return false;
+				return false
 			}
 		} else {
-			return false;
+			return false
 		}
 	},
 	__isTrueValidateCodeBy18IdCard: function(arrIdCard) {
-		let sum = 0;
-		let Wi = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2, 1];
-		let ValideCode = [1, 0, 10, 9, 8, 7, 6, 5, 4, 3, 2];
+		let sum = 0
+		let Wi = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2, 1]
+		let ValideCode = [1, 0, 10, 9, 8, 7, 6, 5, 4, 3, 2]
 		if (arrIdCard[17].toLowerCase() == 'x') {
-			arrIdCard[17] = 10;
+			arrIdCard[17] = 10
 		}
 		for (let i = 0; i < 17; i++) {
-			sum += Wi[i] * arrIdCard[i];
+			sum += Wi[i] * arrIdCard[i]
 		}
-		let valCodePosition = sum % 11;
+		let valCodePosition = sum % 11
 		if (arrIdCard[17] == ValideCode[valCodePosition]) {
-			return true;
+			return true
 		} else {
-			return false;
+			return false
 		}
 	},
 	__isValidityBrithBy18IdCard: function(idCard18) {
-		let year = idCard18.substring(6, 10);
-		let month = idCard18.substring(10, 12);
-		let day = idCard18.substring(12, 14);
-		let temp_date = new Date(year, parseFloat(month) - 1, parseFloat(day));
+		let year = idCard18.substring(6, 10)
+		let month = idCard18.substring(10, 12)
+		let day = idCard18.substring(12, 14)
+		let temp_date = new Date(year, parseFloat(month) - 1, parseFloat(day))
 		if (temp_date.getFullYear() != parseFloat(year) || temp_date.getMonth() != parseFloat(month) - 1 ||
 			temp_date.getDate() !=
 			parseFloat(day)) {
-			return false;
+			return false
 		} else {
-			return true;
+			return true
 		}
 	},
 	__isValidityBrithBy15IdCard: function(idCard15) {
-		let year = idCard15.substring(6, 8);
-		let month = idCard15.substring(8, 10);
-		let day = idCard15.substring(10, 12);
-		let temp_date = new Date(year, parseFloat(month) - 1, parseFloat(day));
+		let year = idCard15.substring(6, 8)
+		let month = idCard15.substring(8, 10)
+		let day = idCard15.substring(10, 12)
+		let temp_date = new Date(year, parseFloat(month) - 1, parseFloat(day))
 
 		if (temp_date.getYear() != parseFloat(year) || temp_date.getMonth() != parseFloat(month) - 1 ||
 			temp_date.getDate() !=
 			parseFloat(day)) {
-			return false;
+			return false
 		} else {
-			return true;
+			return true
 		}
 	},
 	_isAmount: function(value) {
 		//金额,只允许保留两位小数
-		return /^([0-9]*[.]?[0-9])[0-9]{0,1}$/.test(value);
+		return /^([0-9]*[.]?[0-9])[0-9]{0,1}$/.test(value)
 	},
 	_isNum: function(value) {
 		//只能为数字
-		return /^[0-9]+$/.test(value);
+		return /^[0-9]+$/.test(value)
 	},
 	//是否全部为中文
 	_isChinese: function(value) {
-		let reg = /^[\u4e00-\u9fa5]+$/;
-		return value !== "" && reg.test(value) && !form._isSpecial(value) && !form._isEmoji(value)
+		let reg = /^[\u4e00-\u9fa5]+$/
+		return value !== '' && reg.test(value) && !form._isSpecial(value) && !form._isEmoji(value)
 	},
 	//是否不包含中文,可以有特殊字符
 	_isNotChinese: function(value) {
-		let reg = /.*[\u4e00-\u9fa5]+.*$/;
-		let result = true;
+		let reg = /.*[\u4e00-\u9fa5]+.*$/
+		let result = true
 		if (reg.test(value)) {
 			result = false
 		}
@@ -241,12 +242,12 @@ const form = {
 	},
 	_isEnAndNo: function(value) {
 		//8~20位数字和字母组合
-		return /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,20}$/.test(value);
+		return /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,20}$/.test(value)
 	},
 	_isEnOrNo: function(value) {
 		//英文或者数字
-		let reg = /.*[\u4e00-\u9fa5]+.*$/;
-		let result = true;
+		let reg = /.*[\u4e00-\u9fa5]+.*$/
+		let result = true
 		if (reg.test(value) || form._isSpecial(value) || form._isEmoji(value)) {
 			result = false
 		}
@@ -255,31 +256,31 @@ const form = {
 	_isSpecial: function(value) {
 		//是否包含特殊字符
 		let regEn = /[`~!@#$%^&*()_+<>?:"{},.\/;'[\]]/im,
-			regCn = /[·!#¥(——):;“”‘、,|《。》?、【】[\]]/im;
+			regCn = /[·!#¥(——):;“”‘、,|《。》?、【】[\]]/im
 		if (regEn.test(value) || regCn.test(value)) {
-			return true;
+			return true
 		}
-		return false;
+		return false
 	},
 	_isEmoji: function(value) {
 		//是否包含表情
-		return /\uD83C[\uDF00-\uDFFF]|\uD83D[\uDC00-\uDE4F]/g.test(value);
+		return /\uD83C[\uDF00-\uDFFF]|\uD83D[\uDC00-\uDE4F]/g.test(value)
 	},
 	_isDate: function(value) {
 		//2019-10-12
 		const reg =
-			/^(?:(?!0000)[0-9]{4}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-8])|(?:0[13-9]|1[0-2])-(?:29|30)|(?:0[13578]|1[02])-31)|(?:[0-9]{2}(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00)-02-29)$/;
-		return reg.test(value);
+			/^(?:(?!0000)[0-9]{4}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-8])|(?:0[13-9]|1[0-2])-(?:29|30)|(?:0[13578]|1[02])-31)|(?:[0-9]{2}(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00)-02-29)$/
+		return reg.test(value)
 	},
 	_isUrl: function(value) {
-		return /^((https?|ftp|file):\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})(:[0-9]{1,5})?((\/?)|(\/[\\\w_!~*\\'()\\\.;?:@&=+$,%#-]+)+\/?)$/.test(value);
+		return /^((https?|ftp|file):\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})(:[0-9]{1,5})?((\/?)|(\/[\\\w_!~*\\'()\\\.;?:@&=+$,%#-]+)+\/?)$/.test(value)
 	},
 	_isSame: function(value1, value2) {
 		return value1 === value2
 	},
 	_isRange: function(value, range1, range2) {
 		if ((!range1 && range1 != 0) && (!range2 && range2 != 0)) {
-			return true;
+			return true
 		} else if (!range1 && range1 != 0) {
 			return value <= range2
 		} else if (!range2 && range2 != 0) {
@@ -296,18 +297,18 @@ const form = {
 	},
 	_isKeyword: function(value, keywords) {
 		//是否包含关键词,敏感词,多个以英文逗号分隔,包含则为false,弹出提示语!
-		let result = true;
-		if (!keywords) return result;
-		let key = keywords.split(',');
+		let result = true
+		if (!keywords) return result
+		let key = keywords.split(',')
 		for (let i = 0, len = key.length; i < len; i++) {
 			if (~value.indexOf(key[i])) {
-				result = false;
-				break;
+				result = false
+				break
 			}
 		}
-		return result;
+		return result
 	}
-};
+}
 export default {
 	validation: form.validation
-};
+}

+ 1 - 1
components/views/cm-coupon-popup/cm-coupon-popup.vue

@@ -1,6 +1,6 @@
 <template>
     <view class="coupon-popup">
-        <uni-popup ref="popup" mask-background-color="rgba(0,0,0,0.8)" class="popup">
+        <uni-popup ref="popup" mask-background-color="rgba(0,0,0,0.8)" class="popup" :is-mask-click="false">
             <view class="popup-content" :style="[popupContentStyle]">
                 <view class="close iconfont icon-iconfontguanbi" @click="handleClose"></view>
                 <view class="header">

+ 2 - 1
components/views/cm-coupon/cm-coupon.vue

@@ -59,7 +59,8 @@ export default {
                 2: '用户专享券',
                 3: '新用户券',
                 4: '好友邀请券',
-                5: '好友消费券'
+                5: '好友消费券',
+                6: '消费分享券'
             }
             return tags[val] || '未知券'
         },

+ 156 - 110
components/views/cm-share-popup/cm-share-popup.vue

@@ -1,12 +1,17 @@
 <template>
     <view class="share-popup">
         <!-- 弹窗 -->
-        <uni-popup ref="sharePopup" type="bottom" @change="popupChange" :safe-area="safeArea">
-            <view class="popup-content">
-                <view class="title" v-if="title" v-text="title"></view>
+        <uni-popup ref="sharePopup" type="bottom" :safe-area="safeArea" :is-mask-click="false">
+            <view class="popup-content" :class="{ 'no-safe-area': !safeArea }">
+                <view class="title">
+                    <text class="title-text" v-if="title" v-text="title"></text>
+                    <template v-else>
+                        <slot name="title"></slot>
+                    </template>
+                </view>
                 <view class="content">
                     <view class="row">
-                        <button class="share item" open-type="share" @click="close">
+                        <button class="share item" open-type="share" @click="share">
                             <view class="icon-image"><image :src="staticUrl + 'icon-share-wechat.png'"></image></view>
                             <text class="label">微信</text>
                         </button>
@@ -20,7 +25,7 @@
                         </view>
                     </view>
                     <tui-divider :height="64"></tui-divider>
-                    <view class="cancel" @click="close">取消</view>
+                    <view class="cancel" @click="cancel">取消</view>
                 </view>
             </view>
         </uni-popup>
@@ -31,7 +36,14 @@
         <view class="poster-container" v-show="visiable">
             <!-- 画布 -->
             <image :src="posterUrl" class="poster-image"></image>
+            <!-- 下载按钮 -->
+            <view class="poster item" @click="savePoster" v-if="downType === 'fixed'">
+                <view class="icon-image"><image :src="staticUrl + 'icon-download.png'"></image></view>
+                <text class="label">保存相册</text>
+            </view>
         </view>
+        <!-- 海报遮罩层 -->
+        <view class="poster-mask" @click="cancel" v-if="downType === 'fixed' && posterUrl && visiable"></view>
     </view>
 </template>
 
@@ -59,6 +71,11 @@ export default {
         safeArea: {
             type: Boolean,
             default: true
+        },
+        // 海报下载类型
+        downType: {
+            type: String,
+            default: 'fixed'
         }
     },
     data() {
@@ -88,50 +105,76 @@ export default {
         initDrawPoster() {
             this.downLoadImageTask()
         },
+        open() {
+            this.$refs.sharePopup.open()
+            this.$emit('open')
+        },
+        close() {
+            this.$refs.sharePopup?.close()
+            this.$emit('close')
+        },
+        share() {
+            this.$emit('share', this.posterUrl)
+            this.visiable = false
+            this.posterUrl = ''
+            this.close()
+        },
+        cancel() {
+            this.visiable = false
+            this.posterUrl = ''
+            this.close()
+        },
+        savePoster() {
+            uni.saveImageToPhotosAlbum({
+                filePath: this.posterUrl,
+                success: res => {
+                    this.share()
+                }
+            })
+        },
 
         // 下载图片任务
         async downLoadImageTask() {
-            const { avatar, productImage, qrCodeImage } = this.posterData
-            // 背景图片
-            const bgImageUrl = this.staticUrl + 'bg-share-01.png'
-            // 用户头像
-            const avatarUrl = avatar || this.staticUrl + 'icon-join-us.png'
-            // 分享封面
-            let coverUrl = productImage || this.staticUrl + 'icon-share.png'
-            // 分享二维码
-            let ewmUrl = qrCodeImage || this.staticUrl + 'icon-ewm-hehe.jpg'
-
-            // 下载图片任务
-            const taskList = [this.downloadImage(bgImageUrl), this.downloadImage(avatarUrl)]
-
-            // 默认分享封面二维码
-            if (this.type === 'normal') {
-                coverUrl = this.staticUrl + 'icon-share.png' // 默认封面
-                ewmUrl = this.staticUrl + 'icon-ewm-hehe.jpg' // 默认二维码
-                taskList.push(this.downloadImage(coverUrl))
-                taskList.push(this.downloadImage(ewmUrl))
-            } else {
-                taskList.push(this.downloadImage(coverUrl))
-                taskList.push(
-                    generateWxUnlimited({
+            // 执行下载图片
+            try {
+                const { avatar, productImage, qrCodeImage } = this.posterData
+                // 背景图片
+                const bgImageUrl = this.staticUrl + 'bg-share-01.png'
+                // 用户头像
+                const avatarUrl = avatar || this.staticUrl + 'icon-join-us.png'
+                // 分享封面
+                let coverUrl = productImage || this.staticUrl + 'icon-share.png'
+                // 分享二维码
+                let ewmUrl = qrCodeImage || this.staticUrl + 'icon-ewm-hehe.jpg'
+
+                // 默认分享封面二维码
+                if (this.type === 'normal') {
+                    coverUrl = this.staticUrl + 'icon-share.png' // 默认封面
+                    ewmUrl = this.staticUrl + 'icon-ewm-hehe.jpg' // 默认二维码
+                } else {
+                    const { data: iamgeUrl } = await generateWxUnlimited({
                         pagePath: this.posterData.path,
                         queryStr: this.posterData.query
                     })
-                )
-            }
+                    ewmUrl = iamgeUrl
+                }
+
+                // 下载图片任务
+                const taskList = [
+                    this.downloadImage(bgImageUrl),
+                    this.downloadImage(avatarUrl),
+                    this.downloadImage(coverUrl),
+                    this.downloadImage(ewmUrl)
+                ]
 
-            // 执行下载图片
-            try {
                 this.imageList = await Promise.all(taskList)
                 this.drawPoster()
             } catch (e) {
-                console.log(e)
-                // this.$toast('分享失败,请换用其它分享方式')
-                uni.showToast({
-                    title: JSON.stringify(e),
-                    duration: 10000
-                })
-                this.$refs.sharePopup.close()
+                this.cancel()
+                uni.hideLoading()
+                setTimeout(() => {
+                    this.$toast('生成海报失败,请重试')
+                }, 200)
             }
         },
 
@@ -171,6 +214,9 @@ export default {
                         success: res => {
                             this.posterUrl = res.tempFilePath
                             this.visiable = true
+                            if (this.downType === 'fixed') {
+                                this.close()
+                            }
                         },
                         complete: () => {
                             uni.hideLoading()
@@ -298,22 +344,6 @@ export default {
             })
         },
 
-        open() {
-            this.$refs.sharePopup.open()
-            this.$emit('open')
-        },
-        close() {
-            this.$refs.sharePopup.close()
-            this.$emit('close')
-            this.visiable = false
-        },
-        popupChange(e) {
-            if (!e.show) {
-                this.visiable = false
-                this.posterUrl = ''
-            }
-            this.$emit('change', e)
-        },
         async createPoster() {
             // 合并海报数据
             this.posterData = { ...this.posterData, ...this.data }
@@ -336,16 +366,6 @@ export default {
                 //TODO handle the exception
                 uni.hideLoading()
             }
-        },
-        savePoster() {
-            console.log('保存图片到本地')
-            uni.saveImageToPhotosAlbum({
-                filePath: this.posterUrl,
-                success: res => {
-                    this.close()
-                    this.$emit('saveSuccess', this.posterUrl)
-                }
-            })
         }
     }
 }
@@ -361,22 +381,40 @@ export default {
     opacity: 0;
 }
 
+.poster-mask {
+    position: fixed;
+    top: 0;
+    left: 0;
+    z-index: 96;
+    width: 100%;
+    height: 100vh;
+    background-color: rgba(0, 0, 0, 0.4);
+}
+
 .poster-container {
-    z-index: 100;
+    z-index: 99;
     position: fixed;
     top: 80rpx;
     left: 50%;
     transform: translateX(-50%);
     width: 540rpx;
-    height: 878rpx;
-    background-color: #fff;
     overflow: hidden;
+    text-align: center;
 
     .poster-image {
         display: block;
         width: 540rpx;
         height: 878rpx;
     }
+
+    .poster {
+        display: inline-block;
+        margin: 0 auto;
+        margin-top: 48rpx;
+        .label {
+            color: #fff !important;
+        }
+    }
 }
 
 .popup-content {
@@ -386,6 +424,10 @@ export default {
     border-radius: 16rpx 16rpx 0 0;
     background-color: #fff;
 
+    &.no-safe-area {
+        transform: translateY(34px);
+    }
+
     &::after {
         position: absolute;
         content: '';
@@ -397,58 +439,62 @@ export default {
     }
 
     .title {
-        font-size: 34rpx;
-        color: #666;
-        text-align: center;
-        padding-bottom: 28rpx;
-    }
-
-    .content {
-        .row {
-            @extend .cm-flex-around;
+        .title-text {
+            font-size: 34rpx;
+            color: #666;
+            text-align: center;
+            padding-bottom: 28rpx;
         }
+    }
+}
 
-        .item {
-            @extend .cm-flex-center;
-            flex-direction: column;
+.popup-content,
+.poster-container {
+    .row {
+        @extend .cm-flex-around;
+    }
 
-            .label {
-                color: #333;
-                font-size: 26rpx;
-                margin-top: 16rpx;
-            }
+    .item {
+        @extend .cm-flex-center;
+        flex-direction: column;
 
-            .icon-image {
-                @extend .cm-flex-center;
-                width: 100rpx;
-                height: 100rpx;
-                background-color: #f7f7f7;
+        .label {
+            color: #333;
+            font-size: 26rpx;
+            margin-top: 16rpx;
+        }
 
-                image {
-                    width: 64rpx;
-                    height: 64rpx;
-                    display: block;
-                }
+        .icon-image {
+            @extend .cm-flex-center;
+            width: 100rpx;
+            height: 100rpx;
+            background-color: #f7f7f7;
+            border-radius: 50%;
+
+            image {
+                width: 64rpx;
+                height: 64rpx;
+                display: block;
             }
+        }
 
-            &.share {
-                line-height: inherit;
-                padding: 0;
-                margin: 0;
+        &.share {
+            line-height: inherit;
+            padding: 0;
+            margin: 0;
+            border: 0;
+            background: transparent;
+            &::after {
                 border: 0;
-                background: transparent;
-                &::after {
-                    border: 0;
-                }
             }
         }
-        .cancel {
-            font-size: 28rpx;
-            color: #666;
-            font-weight: bold;
-            text-align: center;
-            padding-bottom: 32rpx;
-        }
+    }
+    .cancel {
+        font-size: 28rpx;
+        color: #666;
+        font-weight: bold;
+        text-align: center;
+        padding-bottom: 32rpx;
     }
 }
 </style>

+ 1 - 4
pages/authorize/login-custom.vue

@@ -2,7 +2,7 @@
     <view class="login-custom">
         <view class="container">
             <!-- logo -->
-            <image class="logo" :src="staticUrl + 'icon-logo@2x.png'" mode="widthFix"></image>
+            <image class="logo" :src="staticUrl + 'logo2022525.png'" mode="widthFix"></image>
             <!-- 登录表单 -->
             <view class="login-form">
                 <view class="form-control">
@@ -89,9 +89,6 @@ export default {
             return `重新获取(${this.countDownStatus}s)`
         }
     },
-    beforeDestroy() {
-        uni.removeStorageSync('LOGIN_REDIRECT_URL')
-    },
     methods: {
         // 获取用户信息
         async getUserProfile() {

+ 4 - 3
pages/index/mixins/share-entry.js

@@ -12,14 +12,15 @@ const shareEntry = {
                 dealerUserId: '', // 协销用户ID
                 keyWord: '', // 搜索关键词
                 productId: '', // 产品ID
-                jumpState: '' // 跳转类型 普通用户 协销
+                jumpState: '', // 跳转类型 普通用户 协销
+                collageId: ''
             }
         }
     },
     methods: {
         // 处理分享参数
         shareHandle(query, type) {
-            if (!query) return;
+            if (!query) return
             console.log(query)
             // 小程序分享
             if (type === 'state_str') {
@@ -41,7 +42,7 @@ const shareEntry = {
                 this.$store.commit('user/SET_INVITE_USER_ID', this.shareData.inviteUserId)
             }
 
-            console.log(this.shareData);
+            console.log(this.shareData)
 
             this.shareData.type = parseInt(this.shareData.type)
             this.jumpTopSharePage()

+ 8 - 2
pages/tabBar/home/home.vue

@@ -12,6 +12,7 @@
         <cm-banner
             :list="bannerList"
             :current="current"
+            :autoplay="autoplay"
             @change="index => (current = index)"
             @click="onSwiperClick"
         ></cm-banner>
@@ -59,7 +60,7 @@
         ></tui-scroll-top>
 
         <!-- 分享弹窗 -->
-        <cm-share-popup ref="sharePopup" :data="posterData" type="normal" :safeArea="false"></cm-share-popup>
+        <cm-share-popup ref="sharePopup" :data="posterData" type="normal"></cm-share-popup>
     </view>
 </template>
 
@@ -85,7 +86,8 @@ export default {
             isRefresh: false,
             couponTipStr: '',
             scrollTop: 0,
-            posterData: {}
+            posterData: {},
+            autoplay: true
         }
     },
     computed: {
@@ -113,6 +115,10 @@ export default {
         this.checkCouponAlert()
         this.fetchCartKindCount() // 购物车商品数量
         this.fetchCouponList()
+        this.autoplay = true
+    },
+    onHide() {
+        this.autoplay = false
     },
     onLoad() {
         this.initHomeInfo()

+ 9 - 6
pages/views/activity/activity-detail.vue

@@ -40,12 +40,15 @@
 
         <!-- 分享弹窗 -->
         <cm-share-popup ref="sharePopup" :data="posterData" type="activity"></cm-share-popup>
-
-        <!-- 分享按钮 -->
-        <view class="share-button" v-if="type === 'other' && scrollTop < 60" @click="onShare">
-            <text class="iconfont icon-fenxiang"></text>
-            <text class="label">分享</text>
-        </view>
+        
+        <!-- 返回顶部 -->
+        <tui-scroll-top
+            :scrollTop="scrollTop"
+            :isShare="true"
+            :bottom="60"
+            :customShare="true"
+            @share="onShare"
+        ></tui-scroll-top>
     </view>
 </template>
 

+ 75 - 0
pages/views/goods/commons/helper.js

@@ -0,0 +1,75 @@
+import { navbarButtonGroup } from '../config/config.js'
+
+// 获取产品活动类型 (拼团 活动价 限时特价)
+export function generateActivityType(productData) {
+    const { collageStatus = 0, activeStatus = 0, discountStatus = 0 } = productData
+    // 拼团价
+    if (collageStatus > 0) {
+        return 'group' // 拼团价
+    }
+    // 限时活动
+    else if (discountStatus > 0) {
+        return 'time-limit'
+    }
+    // 普通活动价
+    else if (activeStatus > 0) {
+        return 'activity'
+    }
+    // 普通商品
+    return 'normal' // 普通价
+}
+
+// 获取产品价格类型
+export function generatePriceType(productData) {
+    const { couponStatus = 0, collageStatus = 0, activeStatus = 0, discountStatus = 0 } = productData
+    // 拼团价
+    if (collageStatus > 0) {
+        if (couponStatus === 1) {
+            return 'groupWithCoupon' // 拼团券后价
+        } else {
+            return 'group' // 拼团价
+        }
+    }
+    // 限时活动
+    else if (discountStatus > 0 || activeStatus > 0) {
+        if (couponStatus === 1) {
+            return 'activityWithCoupon' // 券后价
+        } else {
+            return 'normal' // 限时活动价格
+        }
+    }
+    // 无活动价
+    else {
+        if (couponStatus === 1) {
+            return 'normalWithCoupon' // 普通券后价
+        } else {
+            return 'normal' // 普通价
+        }
+    }
+}
+
+export function generateNavbarButtonText(productData) {
+    const { priceType } = productData
+    const navbarButton = navbarButtonGroup[priceType]
+    // 拼团券后价购买
+    if (priceType === 'groupWithCoupon') {
+        navbarButton.left[1] = `¥${productData.normalCouponPrice.toFixed(2)}`
+        navbarButton.right[1] = `¥${productData.couponPrice.toFixed(2)}`
+    }
+    // 拼团价购买
+    else if (priceType === 'group') {
+        navbarButton.left[1] = `¥${productData.normalPrice.toFixed(2)}`
+        navbarButton.right[1] = `¥${productData.price.toFixed(2)}`
+    }
+    // 活动价券后价购买(限时特价|普通活动)
+    else if (priceType === 'activityWithCoupon') {
+        navbarButton.right[1] = `¥${productData.couponPrice.toFixed(2)}`
+    }
+    // 普通价券后价购买
+    else if (priceType === 'normalWithCoupon') {
+        navbarButton.right[1] = `¥${productData.couponPrice.toFixed(2)}`
+    } else {
+        navbarButton.right[1] = ''
+    }
+    return navbarButton
+}

+ 4 - 0
pages/views/goods/components/goods-coupon-list/goods-coupon-list.vue

@@ -39,6 +39,10 @@ export default {
             border-radius: 4rpx;
             color: #ff457b;
             font-size: 22rpx;
+            width: 200rpx;
+            overflow: hidden;
+            text-overflow: ellipsis;
+            white-space: nowrap;
 
             &::before {
                 content: '券 |';

+ 4 - 0
pages/views/goods/components/goods-coupon-section/goods-coupon-section.vue

@@ -51,6 +51,10 @@ export default {
                 border-radius: 4rpx;
                 color: #ff457b;
                 font-size: 22rpx;
+                width: 200rpx;
+                overflow: hidden;
+                text-overflow: ellipsis;
+                white-space: nowrap;
 
                 &::before {
                     content: '券 |';

+ 1 - 11
pages/views/goods/components/goods-price/goods-price.vue

@@ -62,17 +62,7 @@ export default {
     computed: {
         /* 商品价格类型 normal: 普通价 | group: 拼团价 | activity: 活动价 | time-limit: 限时特价 | coupon: 券后价 */
         priceType() {
-            let type
-            if (this.productData.activeStatus > 0) {
-                type = 'activity'
-            } else if (this.productData.collageStatus > 0) {
-                type = 'group'
-            } else if (this.productData.discountStatus > 0) {
-                type = 'time-limit'
-            } else {
-                type = 'normal'
-            }
-            return type
+            return this.productData?.activityType
         },
         // 有可使用优惠券
         hasCouponPrice() {

+ 20 - 3
pages/views/goods/components/goods-receive-buy-popup/goods-receive-buy-popup.vue

@@ -24,7 +24,15 @@
                         <!-- 单价 -->
                         <view class="row">
                             <view class="label">单价</view>
-                            <view class="amount">{{ productPrice | priceFormat }}</view>
+                            <!-- 拼团价 -->
+                            <template v-if="productData.activityType === 'group'">
+                                <view class="amount" v-if="groupBuyFlag">{{ productPrice | priceFormat }}</view>
+                                <view class="amount" v-else>{{ productData.normalPrice | priceFormat }}</view>
+                            </template>
+                            <!-- 其它价格 -->
+                            <template v-else>
+                                <view class="amount">{{ productPrice | priceFormat }}</view>
+                            </template>
                         </view>
                         <!-- 券后价 -->
                         <view class="row" v-if="productData.couponStatus === 1">
@@ -40,8 +48,13 @@
                     </template>
                 </view>
                 <tui-button type="base" width="600rpx" height="90rpx" shape="circle" @click="$emit('submit', count)">
-                    <!-- {{ navbarType === 'buy' ? (productData.couponStatus > 0 ? '领券购买' : '立即购买') : '加入购物车' }} -->
-                    {{ navbarType === 'buy' ? (productData.couponStatus > 0 ? '领券购买' : '确认') : '确认' }}
+                    <template v-if="navbarType === 'buy'">
+                        <text v-if="productData.couponStatus === 1">领券购买</text>
+                        <text v-else>立即购买</text>
+                    </template>
+                    <template v-else>
+                        确认
+                    </template>
                 </tui-button>
             </view>
         </uni-popup>
@@ -68,6 +81,10 @@ export default {
         navbarType: {
             type: String,
             default: 'buy'
+        },
+        groupBuyFlag: {
+            type: Boolean,
+            default: true
         }
     },
     data() {

+ 42 - 24
pages/views/goods/goods-detail.vue

@@ -3,7 +3,7 @@
         <tui-skeleton v-if="isRequest" :loadingType="3" :isLoading="true"></tui-skeleton>
 
         <!-- 顶部导航 -->
-        <goods-top-tabs @change="onTabChange" :current="currentTab" v-show="scorllTop > 100"></goods-top-tabs>
+        <goods-top-tabs @change="onTabChange" :current="currentTab" v-show="scrollTop > 100"></goods-top-tabs>
 
         <!-- 锚点0 -->
         <view id="anchor-0" class="anchor"></view>
@@ -14,6 +14,7 @@
             @click="onSwiperClick"
             @change="onSwiperChange"
             :current="current"
+            :autoplay="autoplay"
         ></goods-image-swiper>
         <!-- 价格 -->
         <goods-price :productData="productInfo"></goods-price>
@@ -95,6 +96,7 @@
             ref="receiveBuyPopup"
             :productData="productInfo"
             :couponTip="couponTip"
+            :groupBuyFlag="groupBuyFlag"
             :navbarType="navbarTypeFlag"
             @detail="$refs.activitypPopup.open()"
             @submit="onSubmit"
@@ -111,6 +113,9 @@
             @couponClick="onCouponClick"
         ></cm-coupon-popup>
 
+        <!-- 返回顶部 -->
+        <tui-scroll-top :scrollTop="scrollTop" :bottom="80"></tui-scroll-top>
+
         <!-- 安全区域 -->
         <cm-safe-area-bottom></cm-safe-area-bottom>
     </view>
@@ -118,7 +123,7 @@
 
 <script>
 // 配置
-import { navbarButtonGroup } from './config/config.js'
+import { generateActivityType, generatePriceType, generateNavbarButtonText } from './commons/helper.js'
 import { debounce } from '@/common/utils.js'
 import { shareDataResult } from '@/common/share.helper.js'
 import { fetchProductDetail } from '@/services/api/goods.js'
@@ -138,14 +143,16 @@ export default {
             rightButton: {},
             // 锚点列表
             anchorList: [],
-            scorllTop: 0,
+            scrollTop: 0,
             productInfo: {},
             couponList: [],
             couponVisiable: false,
             navbarTypeFlag: '',
             // 海报数据
             posterData: {},
-            collageId: ''
+            collageId: '',
+            groupBuyFlag: false, // 用户是否拼团购买
+            autoplay: true,
         }
     },
     computed: {
@@ -168,11 +175,16 @@ export default {
         },
         // 当前商品默认可以使的优惠券
         couponTip() {
-            return this.productInfo?.couponInfo?.split('|')[1]
+            if (this.productInfo.couponId) {
+                const currentCoupon = this.couponList.find(coupon => this.productInfo.couponId === coupon.couponId)
+                return currentCoupon?.couponTitle
+            } else {
+                return this.productInfo?.couponInfo?.split('|')[1]
+            }
         }
     },
     onPageScroll(e) {
-        this.scorllTop = e.scrollTop
+        this.scrollTop = e.scrollTop
         this.getAnchorList()
     },
     onShareAppMessage() {
@@ -189,6 +201,12 @@ export default {
         this.jumpState = parseInt(options.jumpState)
         this.fetchProductDetail()
     },
+    onShow() {
+        this.autoplay = true
+    },
+    onHide() {
+        this.autoplay = false
+    },
     methods: {
         ...mapActions('cart', ['addToCart']),
 
@@ -217,7 +235,7 @@ export default {
                     productId: this.productInfo.productId, // 产品id
                     productCount: count, // 产品购买数量
                     heUserId: this.productInfo.heUserId, // 协销用户id
-                    collageFlag: this.productInfo.collageStatus, // 是否是拼团商品
+                    collageFlag: this.groupBuyFlag ? 1 : 0, // 是否拼团购买
                     collageId: this.collageId, // 拼团id
                     couponId: this.productInfo.couponId, // 默认使用优惠券id
                     allCount: count // 商品总数
@@ -254,7 +272,7 @@ export default {
                 productPrice: this.productInfo.price,
                 productOriginPrice:
                     this.productInfo.normalPrice === this.productInfo.price ? 0 : this.productInfo.normalPrice,
-                productImage: 'https://picsum.photos/1000/1000?random=1',
+                productImage: this.productInfo.mainImage,
                 query: query
             }
             this.$refs.sharePopup.open()
@@ -276,20 +294,7 @@ export default {
 
         // 初始化导航按钮文案
         initNavbarButton() {
-            const navbarButton = navbarButtonGroup[this.navbarType]
-            if (this.navbarType === 'groupWithCoupon') {
-                navbarButton.left[1] = `¥${this.productInfo.normalCouponPrice.toFixed(2)}`
-                navbarButton.right[1] = `¥${this.productInfo.couponPrice.toFixed(2)}`
-            } else if (this.navbarType === 'group') {
-                navbarButton.left[1] = `¥${this.productInfo.normalPrice.toFixed(2)}`
-                navbarButton.right[1] = `¥${this.productInfo.price.toFixed(2)}`
-            } else if (this.navbarType === 'activityWithCoupon') {
-                navbarButton.right[1] = `¥${this.productInfo.couponPrice.toFixed(2)}`
-            } else if (this.navbarType === 'normalWithCoupon') {
-                navbarButton.right[1] = `¥${this.productInfo.couponPrice.toFixed(2)}`
-            } else {
-                navbarButton.right[1] = ''
-            }
+            const navbarButton = generateNavbarButtonText(this.productInfo)
             this.leftButton = navbarButton.left
             this.rightButton = navbarButton.right
         },
@@ -297,6 +302,11 @@ export default {
         // 导航菜单右侧按钮点击
         navbarRightClick(index) {
             this.navbarTypeFlag = index > 0 || this.productInfo.collageStatus > 0 ? 'buy' : 'cart'
+
+            if (this.productInfo.activityType === 'group') {
+                this.groupBuyFlag = index > 0
+            }
+
             this.$refs.receiveBuyPopup.open()
         },
 
@@ -322,7 +332,7 @@ export default {
             // const selector = `.product-detail #anchor-${index}`
             const offset = this.anchorList[index].top
             uni.pageScrollTo({
-                scrollTop: this.scorllTop + offset - 40 - 10,
+                scrollTop: this.scrollTop + offset - 40 - 10,
                 duration: 300
             })
         },
@@ -356,7 +366,7 @@ export default {
         async fetchProductDetail() {
             try {
                 const res = await fetchProductDetail({ productId: this.productId, userId: this.userId })
-                this.productInfo = res.data
+                this.productInfo = this.generateProductInfo(res.data)
                 this.isRequest = false
                 this.productInfo.heUserId = this.jumpState === 1 ? 0 : this.userId
                 this.initNavbarButton()
@@ -426,6 +436,14 @@ export default {
                 console.log(e)
                 console.log('获取优惠券列表失败')
             }
+        },
+
+        // 处理商品信息
+        generateProductInfo(product = {}) {
+            // 商品活动类型
+            product.activityType = generateActivityType(product)
+            product.priceType = generatePriceType(product)
+            return product
         }
     }
 }

+ 1 - 1
pages/views/goods/goods-list.vue

@@ -22,7 +22,7 @@
         <!-- 加载更多 -->
         <cm-loadmore :hasNextPage="hasNextPage" :isLoading="isLoading" :visiable="!hideLoadmore"></cm-loadmore>
         <!-- 回到顶部 -->
-        <tui-scroll-top :scrollTop="scrollTop" :bottom="30" :duration="600"></tui-scroll-top>
+        <tui-scroll-top :scrollTop="scrollTop" :bottom="60"></tui-scroll-top>
         <!-- 安全区域 -->
         <cm-safe-area-bottom v-if="hideLoadmore"></cm-safe-area-bottom>
     </view>

+ 2 - 2
pages/views/goods/goods-search.vue

@@ -134,9 +134,9 @@ export default {
         },
 
         toDetail(row) {
-            this.$router.navigateTo(`goods/goods-detail?jumpState=1?productId=${row.productId}`)
+            this.$router.navigateTo(`goods/goods-detail?jumpState=1&productId=${row.productId}`)
         },
-        // 加入购物车
+        // 加入购物车 
         addCart(row) {
             this.$store.dispatch('cart/addToCart', { productId: row.productId })
         },

+ 2 - 2
pages/views/order/components/order-product/order-product.vue

@@ -12,8 +12,8 @@
                 <view class="tag pt" v-if="isCollagePrice">拼团价</view>
                 <view class="tag hd" v-else-if="isActivityPrice">活动价</view>
                 <view class="tag other" v-else-if="isDiscountPrice">限时特价</view>
-                <view class="tag other" v-else-if="productInfo.couponStatus > 1">{{ productInfo.couponInfo }}</view>
-                <view class="tag other" v-else-if="productInfo.couponStatus > 0">券后价</view>
+                <!-- <view class="tag other" v-else-if="productInfo.couponStatus > 1">{{ productInfo.couponInfo }}</view>
+                <view class="tag other" v-else-if="productInfo.couponStatus > 0">券后价</view> -->
             </view>
             <view class="price">¥{{ productInfo.price | priceFormat }}</view>
             <view class="buy-num" v-if="numType === 1">×{{ productInfo.num }}</view>

+ 18 - 1
pages/views/order/order-create.vue

@@ -67,7 +67,15 @@
             @checkedNone="onCheckedNone"
         ></cm-coupon-popup>
         <!-- 分享 -->
-        <cm-share-popup ref="sharePopup" :data="posterData" type="normal" @close="onAfterShare"></cm-share-popup>
+        <cm-share-popup ref="sharePopup" :data="posterData" type="normal" @share="onAfterShare">
+            <template #title>
+                <view class="share-title">
+                    分享立减
+                    <text>{{ reduction.reducedAmount }}</text>
+                    元
+                </view>
+            </template>
+        </cm-share-popup>
         <!-- 订单提交拦截 -->
         <tui-modal :show="preventModal" :content="preventText" @click="onPreventModalConfirm"></tui-modal>
         <!-- 安全区域 -->
@@ -536,5 +544,14 @@ export default {
             }
         }
     }
+
+    .share-title {
+        text-align: center;
+        font-size: 34rpx;
+        margin-bottom: 30rpx;
+        text {
+            color: #f83c6c;
+        }
+    }
 }
 </style>

+ 17 - 3
pages/views/order/order-pay.vue

@@ -102,8 +102,8 @@ export default {
         // 支付成功回调
         orderPaySuccess() {
             this.$on('orderPaySuccess', orderInfo => {
-                if (this.collageFlag === 1) {
-                    uni.redirectTo({ url: `share-buy/share-buy-detail?collageId=${this.collageId}` })
+                if (orderInfo.collageFlag) {
+                    this.$router.redirectTo(`share-buy/share-buy-detail?collageId=${orderInfo.collageId}`)
                 } else {
                     uni.setStorageSync('PAY_ORDER_INFO', orderInfo)
                     this.$router.redirectTo('order/pay-success')
@@ -126,7 +126,21 @@ export default {
         async getOrderDetail() {
             try {
                 const { data } = await fetchOrderDetail({ orderId: this.orderId })
-                this.orderList = data.shopOrderList
+                // 如果该订单为拼团订单
+                if (data.order.collageFlag) {
+                    this.orderList = data.shopOrderList.map(order => {
+                        order.collageFlag = data.order.collageFlag
+                        order.collageId = data.order.collageId
+                        order.collageStatus = data.order.collageStatus
+                        order.collageEndTime = data.order.collageEndTime
+                        return order
+                    })
+                } else {
+                    this.orderList = data.shopOrderList.map(order => {
+                        order.shareFlag = data.order.shareFlag
+                        return order
+                    })
+                }
             } catch (e) {
                 console.log('获取订单信息失败')
                 console.log(e)

+ 2 - 2
pages/views/order/pay-faild.vue

@@ -57,8 +57,8 @@ export default {
         // 支付成功回调
         orderPaySuccess() {
             this.$on('orderPaySuccess', orderInfo => {
-                if (this.collageFlag === 1) {
-                    uni.redirectTo({ url: `share-buy/share-buy-detail?collageId=${this.collageId}` })
+                if (orderInfo.collageFlag) {
+                    this.$router.redirectTo(`share-buy/share-buy-detail?collageId=${orderInfo.collageId}`)
                 } else {
                     uni.setStorageSync('PAY_ORDER_INFO', orderInfo)
                     this.$router.redirectTo('order/pay-success')

+ 4 - 4
pages/views/order/pay-success.vue

@@ -38,12 +38,12 @@
                 查看订单
             </tui-button>
             <view class="share">
-                <view v-if="canShare" @click="onShare"><text class="btn-tip">分享可获得优惠券领取资格</text></view>
+                <view v-if="canShare" @click="onShare"><text class="btn-tip">点击分享可获得优惠券领取资格</text></view>
             </view>
         </view>
 
         <!-- 分享 -->
-        <cm-share-popup ref="sharePopup" :data="posterData" type="normal" @close="onAfterShare"></cm-share-popup>
+        <cm-share-popup ref="sharePopup" :data="posterData" type="normal" @share="onAfterShare"></cm-share-popup>
     </view>
 </template>
 
@@ -68,7 +68,7 @@ export default {
             return this.mapStateArr.includes(parseInt(this.orderDetail.status))
         },
         canShare() {
-            return this.couponTipStr.indexOf('3') > -1
+            return this.orderInfo.shareFlag === 1 && this.couponTipStr.indexOf('3') > -1
         }
     },
     beforeDestroy() {
@@ -118,7 +118,7 @@ export default {
         },
         // 订单列表
         onSearch() {
-            this.$router.redirectTo('order/order-list')
+            this.$router.redirectTo(`order/order-detail?orderId=${this.orderInfo.orderId}`)
         },
         // 继续支付
         toRePay() {

+ 24 - 3
pages/views/others/join-us.vue

@@ -1,7 +1,7 @@
 <template>
     <view class="join-us">
         <view class="ewm-container">
-            <view class="qrcode"><image :src="staticUrl + 'ewm-contact.png'" mode=""></image></view>
+            <view class="qrcode"><image :src="qrcodeUrl" mode="" :show-menu-by-longpress="true"></image></view>
             <view class="message">
                 <view class="row">长按识别二维码</view>
                 <view class="row">加微信获取优惠福利</view>
@@ -11,7 +11,28 @@
 </template>
 
 <script>
-export default {}
+import { fetchGroupQrCode } from '@/services/api/common.js'
+export default {
+    data() {
+        return {
+            qrcodeUrl: ''
+        }
+    },
+    onLoad() {
+        this.fetchGroupQrCode()
+    },
+    methods: {
+        async fetchGroupQrCode() {
+            try {
+                const { data } = await fetchGroupQrCode()
+                this.qrcodeUrl = data
+            } catch (e) {
+                //TODO handle the exception
+                console.log(e)
+            }
+        }
+    }
+}
 </script>
 
 <style lang="scss" scoped>
@@ -20,7 +41,7 @@ export default {}
     width: 100%;
     height: 100vh;
     background: url(https://static.caimei365.com/app/mini-hehe/icon/bg-join.png) no-repeat center;
-    background-size: 100% auto;
+    background-size: cover;
     background-color: #fff;
 
     .ewm-container {

+ 70 - 4
pages/views/share-buy/share-buy-detail.vue

@@ -40,12 +40,27 @@
         </view>
 
         <!-- 分享 -->
-        <cm-share-popup ref="sharePopup" :data="posterData" type="product"></cm-share-popup>
+        <cm-share-popup ref="sharePopup" :data="posterData" type="product" @share="onAfterShare">
+            <template #title>
+                <view class="share-title">
+                    <view class="title">
+                        还差
+                        <text v-text="collageData.needNum"></text>
+                        人,赶快邀请好友来拼单吧!
+                    </view>
+                    <view class="share-desc">
+                        拼单已发起,人满后立即发货
+                        <text v-if="canShare">(首次分享可获得一张消费分享券)</text>
+                    </view>
+                </view>
+            </template>
+        </cm-share-popup>
     </view>
 </template>
 
 <script>
-import { fetchCollageOrderDetail } from '@/services/api/order.js'
+import { fetchCollageOrderDetail, orderShare } from '@/services/api/order.js'
+import { fetchCouponDisplay } from '@/services/api/coupon.js'
 import { countDown, queryStringify } from '@/common/utils.js'
 import { mapGetters } from 'vuex'
 export default {
@@ -57,11 +72,15 @@ export default {
             // 海报生成数据
             posterData: {},
             timer: null,
-            countDownTime: {}
+            countDownTime: {},
+            couponTipStr: ''
         }
     },
     computed: {
-        ...mapGetters(['userId'])
+        ...mapGetters(['userId']),
+        canShare() {
+            return this.collageData.shareFlag === 1 && this.couponTipStr.indexOf('3') > -1
+        }
     },
     // 分享到微信用户
     onShareAppMessage() {
@@ -81,11 +100,33 @@ export default {
     },
     onLoad(options) {
         this.collageId = options.collageId
+        this.fetchCouponDisplay()
     },
     onShow() {
         this.fetchOrderDetails()
     },
     methods: {
+        // 获取可领取优惠券类型
+        async fetchCouponDisplay() {
+            try {
+                const res = await fetchCouponDisplay({ userId: this.userId })
+                this.couponTipStr = res.data
+            } catch (e) {
+                console.log('获取优惠券类型失败')
+            }
+        },
+
+        // 分享结束
+        async onAfterShare() {
+            if (!this.canShare) return
+            try {
+                await orderShare({ orderId: this.collageData.orderId, userId: this.userId })
+                this.$toast('分享成功')
+            } catch (e) {
+                this.$toast('分享失败')
+            }
+        },
+
         // 分享
         async onShare() {
             const query = queryStringify({
@@ -166,5 +207,30 @@ export default {
             color: #ff457b;
         }
     }
+
+    .share-title {
+        text-align: center;
+        padding-bottom: 40rpx;
+        .title {
+            font-size: 34rpx;
+            font-weight: bold;
+            line-height: 48rpx;
+            color: #666666;
+
+            text {
+                color: #ff457b;
+            }
+        }
+        .share-desc {
+            margin-top: 14rpx;
+            font-size: 26rpx;
+            color: #333;
+            line-height: 1.6;
+
+            text {
+                color: #ff457b;
+            }
+        }
+    }
 }
 </style>

+ 46 - 1
pages/views/share-buy/share-buy-success.vue

@@ -24,19 +24,37 @@
             >
                 <text>查看订单详情</text>
             </tui-button>
+            <view class="share">
+                <view v-if="canShare" @click="onShare"><text class="btn-tip">点击分享可获得优惠券领取资格</text></view>
+            </view>
         </view>
+
+        <!-- 分享 -->
+        <cm-share-popup ref="sharePopup" :data="posterData" type="normal" @share="onAfterShare"></cm-share-popup>
     </view>
 </template>
 
 <script>
+import { orderShare } from '@/services/api/order.js'
+import { fetchCouponDisplay } from '@/services/api/coupon.js'
+import { mapGetters } from 'vuex'
 export default {
     data() {
         return {
-            collageData: {}
+            collageData: {},
+            posterData: {},
+            couponTipStr: ''
+        }
+    },
+    computed: {
+        ...mapGetters(['userId']),
+        canShare() {
+            return this.collageData.shareFlag === 1 && this.couponTipStr.indexOf('3') > -1
         }
     },
     onLoad() {
         this.collageData = uni.getStorageSync('SHARE_BUY_COLLAGE_DATA')
+        this.fetchCouponDisplay()
     },
     beforeDestroy() {
         uni.removeStorageSync('SHARE_BUY_COLLAGE_DATA')
@@ -49,6 +67,24 @@ export default {
         // 查看订单详情
         handleToOrderDetail() {
             this.$router.navigateTo('order/order-detail?orderId=' + this.collageData.orderId)
+        },
+        // 获取可领取优惠券类型
+        async fetchCouponDisplay() {
+            try {
+                const res = await fetchCouponDisplay({ userId: this.userId })
+                this.couponTipStr = res.data
+            } catch (e) {
+                console.log('获取优惠券类型失败')
+            }
+        },
+        // 分享结束
+        async onAfterShare() {
+            try {
+                await orderShare({ orderId: this.collageData.orderId, userId: this.userId })
+                this.$toast('分享成功')
+            } catch (e) {
+                this.$toast('分享失败')
+            }
         }
     }
 }
@@ -73,6 +109,15 @@ export default {
         .line {
             height: 24rpx;
         }
+        .share {
+            height: 90rpx;
+            line-height: 90rpx;
+            text-align: center;
+            color: #ff457b;
+            .btn-tip {
+                font-size: 24rpx;
+            }
+        }
     }
 }
 </style>

+ 10 - 1
services/api/auth.js

@@ -22,7 +22,16 @@ export function mobileLogin(data) {
 export function getAccessToken(data) {
     return request({
         url: '/user/he/access/token',
-        method: 'get',
+        method: 'GET',
+        data
+    })
+}
+
+/* 获取小程序页面二维码 */
+export function wxUnlimited(data) {
+    return request({
+        url: '/user/he/wxacode',
+        method: 'POST',
         data
     })
 }

+ 8 - 1
services/api/common.js

@@ -18,4 +18,11 @@ export function sendMobileVerification(params) {
     })
 }
 
-
+/* 群二维码图片 */
+export function fetchGroupQrCode(params) {
+    return request({
+        url: '/user/he/group/qrCode',
+        method: 'GET',
+        params
+    })
+}

+ 8 - 1
store/modules/cart.js

@@ -40,8 +40,15 @@ const actions = {
 
         try {
             const res = await shoppingAddCart({ productId, userId: rootGetters.userId, productCount, heUserId })
-            uni.showToast({ icon: 'success', title: '加入购物车成功' })
             dispatch('fetchCartKindCount')
+            setTimeout(() => {
+                uni.showToast({
+                    icon: 'success',
+                    title: '加入购物车成功',
+                    mask: true
+                })
+            }, 200)
+
             return res
         } catch (e) {
             return Promise.reject(e)

+ 7 - 4
store/modules/coupon.js

@@ -41,11 +41,14 @@ const actions = {
 
         try {
             const res = await receiveCoupon({ couponId, couponShareId, userId: rootGetters.userId })
-            uni.showToast({
-                icon: 'success',
-                title: '领取成功'
-            })
             await dispatch('initCouponCount')
+            setTimeout(() => {
+                uni.showToast({
+                    mask: true,
+                    icon: 'success',
+                    title: '领取成功'
+                })
+            }, 200)
             return res
         } catch (e) {
             console.log('领取优惠券失败')