瀏覽代碼

接口调试完成

yuwenjun1997 3 年之前
父節點
當前提交
71cf3587c0
共有 39 個文件被更改,包括 1425 次插入699 次删除
  1. 4 4
      common/business.helper.js
  2. 14 4
      common/css/global.scss
  3. 1 1
      common/filters.js
  4. 159 0
      common/share.helper.js
  5. 161 110
      common/utils.js
  6. 12 12
      components/views/cm-cart-product/cm-cart-product.vue
  7. 4 4
      components/views/cm-drag/cm-drag.vue
  8. 22 7
      components/views/cm-product/cm-product.vue
  9. 63 37
      components/views/cm-share-popup/cm-share-popup.vue
  10. 8 2
      pages.json
  11. 13 3
      pages/index/index.vue
  12. 29 19
      pages/index/mixins/share-entry.js
  13. 47 176
      pages/tabBar/category/category.vue
  14. 17 3
      pages/tabBar/home/home.vue
  15. 113 73
      pages/views/activity/activity-detail.vue
  16. 1 1
      pages/views/coupon/coupon-receive.vue
  17. 1 1
      pages/views/coupon/coupon-user.vue
  18. 6 3
      pages/views/goods/components/goods-activity-popup/goods-activity-popup.vue
  19. 1 1
      pages/views/goods/components/goods-navbar/goods-navbar.vue
  20. 29 4
      pages/views/goods/components/goods-receive-buy-popup/goods-receive-buy-popup.vue
  21. 10 8
      pages/views/goods/config/config.js
  22. 7 28
      pages/views/goods/goods-coupon-list.vue
  23. 38 51
      pages/views/goods/goods-detail.vue
  24. 10 5
      pages/views/goods/goods-list.vue
  25. 27 25
      pages/views/order/components/order-product/order-product.vue
  26. 40 41
      pages/views/order/mixins/orderList.js
  27. 2 3
      pages/views/order/mixins/orderShare.js
  28. 5 3
      pages/views/order/mixins/wechatPay.js
  29. 100 34
      pages/views/order/order-create.vue
  30. 307 0
      pages/views/order/order-pay.vue
  31. 85 10
      pages/views/order/pay-success.vue
  32. 20 12
      pages/views/share-buy/share-buy-detail.vue
  33. 13 1
      pages/views/share-buy/share-buy-entry.vue
  34. 18 10
      services/api/auth.js
  35. 9 0
      services/api/coupon.js
  36. 1 1
      services/api/goods.js
  37. 9 0
      services/api/order.js
  38. 1 0
      store/getters.js
  39. 18 2
      store/modules/user.js

+ 4 - 4
common/business.helper.js

@@ -11,11 +11,11 @@ export function totalAllCheckedProduct(shopList) {
 export function computeTotalPrice(productList) {
 export function computeTotalPrice(productList) {
     const { allPrice } = productList.reduce((prevPrice, product) => {
     const { allPrice } = productList.reduce((prevPrice, product) => {
         // 已选商品总价
         // 已选商品总价
-        prevPrice.originalPrice += product.price * product.productCount
+        prevPrice.originalPrice += product.price * product.num
         // 单品满减
         // 单品满减
         if (product.promotion && product.promotion.type == 1 && product.promotion.mode == 2) {
         if (product.promotion && product.promotion.type == 1 && product.promotion.mode == 2) {
             // 是否满足 满减条件
             // 是否满足 满减条件
-            if (product.price * product.productCount >= product.promotion.touchPrice) {
+            if (product.price * product.num >= product.promotion.touchPrice) {
                 prevPrice.reducedPrice += product.promotion.reducedPrice
                 prevPrice.reducedPrice += product.promotion.reducedPrice
             }
             }
         }
         }
@@ -67,7 +67,7 @@ export function splitCouponList(couponList = [], productList = []) {
 
 
 // 判断全部商品可用 (全部商品价格总计 是否大于 当前优惠券的触发金额)
 // 判断全部商品可用 (全部商品价格总计 是否大于 当前优惠券的触发金额)
 export function allProdoctUseCheck(productList, coupon) {
 export function allProdoctUseCheck(productList, coupon) {
-    const countPrice = productList.reduce((countPrice, product) => countPrice + product.price * product.productCount, 0)
+    const countPrice = productList.reduce((countPrice, product) => countPrice + product.price * product.num, 0)
     console.log('all', countPrice)
     console.log('all', countPrice)
     return countPrice >= coupon.touchPrice
     return countPrice >= coupon.touchPrice
 }
 }
@@ -77,7 +77,7 @@ export function someProductUseCheck(productList, coupon) {
     const countPrice = productList.reduce((countPrice, product) => {
     const countPrice = productList.reduce((countPrice, product) => {
         // 当前优惠券可用的商品总价
         // 当前优惠券可用的商品总价
         const isIncludes = coupon.productIds.indexOf(product.productId.toString()) > -1
         const isIncludes = coupon.productIds.indexOf(product.productId.toString()) > -1
-        return isIncludes ? countPrice + product.price * product.productCount : countPrice
+        return isIncludes ? countPrice + product.price * product.num : countPrice
     }, 0)
     }, 0)
     console.log('some', countPrice)
     console.log('some', countPrice)
     return countPrice >= coupon.touchPrice
     return countPrice >= coupon.touchPrice

+ 14 - 4
common/css/global.scss

@@ -34,14 +34,17 @@
         height: 30rpx;
         height: 30rpx;
         text-align: center;
         text-align: center;
         line-height: 30rpx;
         line-height: 30rpx;
-        font-size: 22rpx;
-        padding: 0 8rpx;
+        font-size: 18rpx;
+        padding: 0 4rpx;
+        vertical-align: middle;
         &.cx {
         &.cx {
+            // 促销 自营标签
             background: #f83c6c;
             background: #f83c6c;
             border-radius: 4rpx;
             border-radius: 4rpx;
             color: #ffffff;
             color: #ffffff;
         }
         }
         &.hd {
         &.hd {
+            // 活动价标签
             width: 80rpx;
             width: 80rpx;
             box-sizing: border-box;
             box-sizing: border-box;
             padding: 0;
             padding: 0;
@@ -50,15 +53,22 @@
             color: #f83c6c;
             color: #f83c6c;
         }
         }
         &.pt {
         &.pt {
+            // 拼团价标签
             background: linear-gradient(270deg, #ff457b 0%, #b03bb8 51%, #6431f2 100%);
             background: linear-gradient(270deg, #ff457b 0%, #b03bb8 51%, #6431f2 100%);
             color: #fff;
             color: #fff;
             border-radius: 4rpx;
             border-radius: 4rpx;
         }
         }
         &.other {
         &.other {
+            // 其他标签
             border: 1rpx solid #f83c6c;
             border: 1rpx solid #f83c6c;
-            padding: 0 6rpx;
+            height: 28rpx;
+            line-height: 28rpx;
             color: #f83c6c;
             color: #f83c6c;
             border-radius: 4rpx;
             border-radius: 4rpx;
+            max-width: 100%;
+            white-space: nowrap;
+            overflow: hidden;
+            text-overflow: ellipsis;
         }
         }
     }
     }
 }
 }
@@ -117,7 +127,7 @@
     bottom: 0;
     bottom: 0;
 }
 }
 
 
-.sticky-top{
+.sticky-top {
     position: sticky;
     position: sticky;
     z-index: 90;
     z-index: 90;
     width: 100%;
     width: 100%;

+ 1 - 1
common/filters.js

@@ -7,7 +7,7 @@ const install = Vue => {
         if (typeof value !== 'number') {
         if (typeof value !== 'number') {
             value = parseFloat(value)
             value = parseFloat(value)
         }
         }
-        return value.toFixed(2)
+        return value.toFixed(2) > 0 ? value.toFixed(2) : 0
     })
     })
 
 
     // 格式化时间
     // 格式化时间

+ 159 - 0
common/share.helper.js

@@ -1,4 +1,8 @@
 import { encrypt } from '@/common/crypto.js'
 import { encrypt } from '@/common/crypto.js'
+/* 小程序码 */
+import store from '@/store/index.js'
+const fs = uni.getFileSystemManager()
+const qrcodePath = `${wx.env.USER_DATA_PATH}/qrcodePath`
 
 
 const defalutOptions = {
 const defalutOptions = {
     title: '护肤上颜选,正品有好货~',
     title: '护肤上颜选,正品有好货~',
@@ -15,3 +19,158 @@ export function shareDataResult(shareData, title, coverUrl) {
     }
     }
     return result
     return result
 }
 }
+
+const queryKeyOfMap = {
+    'type': 't',
+    'inviteUserId': 'i',
+    'activityId': 'a',
+    'dealerUserId': 'd',
+    'keyWord': 'k',
+    'productId': 'p',
+    'jumpState': 'j',
+}
+
+const enQueryKeyOfMap = {
+    't': 'type',
+    'i': 'inviteUserId',
+    'a': 'activityId',
+    'd': 'dealerUserId',
+    'k': 'keyWord',
+    'p': 'productId',
+    'j': 'jumpState',
+}
+
+// 创建二维码保存路径
+function createQrcodeDir(callback) {
+    try {
+        fs.accessSync(qrcodePath)
+        console.log('已存在文件夹');
+        callback(qrcodePath)
+    } catch (e) {
+        fs.mkdirSync(qrcodePath)
+        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 result
+    } catch (e) {
+        debugger
+        return e
+    }
+}
+
+// 编码查询参数
+export function codeQueryStr(query = '') {
+    const keys = Object.keys(queryKeyOfMap)
+    return query.split('&').map(str => {
+        return str.split('=').map((substr, index) => {
+            if (!index) {
+                return queryKeyOfMap[keys.find(item => substr === item)]
+            } else {
+                return substr
+            }
+        }).join('=')
+    }).join('&')
+}
+
+// 反编码查询参数
+export function enCodeQueryStr(query) {
+    const keys = Object.keys(enQueryKeyOfMap)
+    return query.split('&').map(str => {
+        return str.split('=').map((substr, index) => {
+            if (!index) {
+                return enQueryKeyOfMap[keys.find(item => substr === item)]
+            } else {
+                return substr
+            }
+        }).join('=')
+    }).join('&')
+}

+ 161 - 110
common/utils.js

@@ -6,25 +6,25 @@
  * @returns {Function} 返回包装后的函数
  * @returns {Function} 返回包装后的函数
  */
  */
 export function debounce(func, wait, immediate = true) {
 export function debounce(func, wait, immediate = true) {
-	let timeout, result
-
-	return function() {
-		const context = this
-		const args = arguments
-		if (timeout) clearTimeout(timeout)
-		if (immediate) {
-			const callNow = !timeout
-			timeout = setTimeout(function() {
-				timeout = null
-			}, wait)
-			if (callNow) result = func.apply(context, args)
-		} else {
-			timeout = setTimeout(function() {
-				func.apply(context, args)
-			}, wait)
-		}
-		return result
-	}
+    let timeout, result
+
+    return function() {
+        const context = this
+        const args = arguments
+        if (timeout) clearTimeout(timeout)
+        if (immediate) {
+            const callNow = !timeout
+            timeout = setTimeout(function() {
+                timeout = null
+            }, wait)
+            if (callNow) result = func.apply(context, args)
+        } else {
+            timeout = setTimeout(function() {
+                func.apply(context, args)
+            }, wait)
+        }
+        return result
+    }
 }
 }
 
 
 
 
@@ -35,17 +35,17 @@ export function debounce(func, wait, immediate = true) {
  * @returns {Function} 返回包装后的函数
  * @returns {Function} 返回包装后的函数
  */
  */
 export function throttle(func, wait) {
 export function throttle(func, wait) {
-	let timeout
-	return function() {
-		const context = this
-		const args = arguments
-		if (!timeout) {
-			timeout = setTimeout(function() {
-				timeout = null
-				func.apply(context, args)
-			}, wait)
-		}
-	}
+    let timeout
+    return function() {
+        const context = this
+        const args = arguments
+        if (!timeout) {
+            timeout = setTimeout(function() {
+                timeout = null
+                func.apply(context, args)
+            }, wait)
+        }
+    }
 }
 }
 
 
 
 
@@ -55,21 +55,21 @@ export function throttle(func, wait) {
  * @returns {object} 返回目标对象深度克隆后的结果
  * @returns {object} 返回目标对象深度克隆后的结果
  */
  */
 export function deepClone(obj, cache = new WeakMap()) {
 export function deepClone(obj, cache = new WeakMap()) {
-	if (typeof obj !== 'object') return obj // 普通类型,直接返回
-	if (obj === null) return obj
-	if (cache.get(obj)) return cache.get(obj) // 防止循环引用,程序进入死循环
-	if (obj instanceof Date) return new Date(obj)
-	if (obj instanceof RegExp) return new RegExp(obj)
-
-	// 找到所属原型上的constructor,所属原型上的constructor指向当前对象的构造函数
-	let cloneObj = new obj.constructor()
-	cache.set(obj, cloneObj) // 缓存拷贝的对象,用于处理循环引用的情况
-	for (let key in obj) {
-		if (obj.hasOwnProperty(key)) {
-			cloneObj[key] = deepClone(obj[key], cache) // 递归拷贝
-		}
-	}
-	return cloneObj
+    if (typeof obj !== 'object') return obj // 普通类型,直接返回
+    if (obj === null) return obj
+    if (cache.get(obj)) return cache.get(obj) // 防止循环引用,程序进入死循环
+    if (obj instanceof Date) return new Date(obj)
+    if (obj instanceof RegExp) return new RegExp(obj)
+
+    // 找到所属原型上的constructor,所属原型上的constructor指向当前对象的构造函数
+    let cloneObj = new obj.constructor()
+    cache.set(obj, cloneObj) // 缓存拷贝的对象,用于处理循环引用的情况
+    for (let key in obj) {
+        if (obj.hasOwnProperty(key)) {
+            cloneObj[key] = deepClone(obj[key], cache) // 递归拷贝
+        }
+    }
+    return cloneObj
 }
 }
 
 
 
 
@@ -80,25 +80,25 @@ export function deepClone(obj, cache = new WeakMap()) {
  * @returns {string} 格式化后的时间  '2017-01-01 01:00:00'
  * @returns {string} 格式化后的时间  '2017-01-01 01:00:00'
  */
  */
 export function dateFormat(date = new Date(), format = 'yyyy-MM-dd hh:mm:ss') {
 export function dateFormat(date = new Date(), format = 'yyyy-MM-dd hh:mm:ss') {
-	var o = {
-		'M+': date.getMonth() + 1, // month
-		'd+': date.getDate(), // day
-		'h+': date.getHours(), // hour
-		'm+': date.getMinutes(), // minute
-		's+': date.getSeconds(), // second
-		'q+': Math.floor((date.getMonth() + 3) / 3), // quarter
-		S: date.getMilliseconds(), // millisecond
-	}
-	if (/(y+)/.test(format)) {
-		format = format.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length))
-	}
-	for (var k in o) {
-		if (new RegExp('(' + k + ')').test(format)) {
-			format = format.replace(RegExp.$1, RegExp.$1.length === 1 ? o[k] : ('00' + o[k]).substr(('' + o[k])
-				.length))
-		}
-	}
-	return format
+    var o = {
+        'M+': date.getMonth() + 1, // month
+        'd+': date.getDate(), // day
+        'h+': date.getHours(), // hour
+        'm+': date.getMinutes(), // minute
+        's+': date.getSeconds(), // second
+        'q+': Math.floor((date.getMonth() + 3) / 3), // quarter
+        S: date.getMilliseconds(), // millisecond
+    }
+    if (/(y+)/.test(format)) {
+        format = format.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length))
+    }
+    for (var k in o) {
+        if (new RegExp('(' + k + ')').test(format)) {
+            format = format.replace(RegExp.$1, RegExp.$1.length === 1 ? o[k] : ('00' + o[k]).substr(('' + o[k])
+                .length))
+        }
+    }
+    return format
 }
 }
 
 
 
 
@@ -110,59 +110,110 @@ export function dateFormat(date = new Date(), format = 'yyyy-MM-dd hh:mm:ss') {
  * @param callback 回调
  * @param callback 回调
  */
  */
 export function countDown(diff, loadTime, item, callback) {
 export function countDown(diff, loadTime, item, callback) {
-	function round($diff) {
-		let dd = parseInt($diff / 1000 / 60 / 60 / 24, 10) // 计算剩余的天数
-		let hh = parseInt(($diff / 1000 / 60 / 60) % 24, 10) // 计算剩余的小时数
-		let mm = parseInt(($diff / 1000 / 60) % 60, 10) // 计算剩余的分钟数
-		let ss = parseInt(($diff / 1000) % 60, 10) // 计算剩余的秒数
-
-		function checkTime(_a) {
-			let a = _a
-			if (a < 10) {
-				a = '0' + a
-			}
-			return a.toString()
-		}
-
-		item.conttainer = {
-			ddhh: checkTime(dd * 24 + hh),
-			dd: checkTime(dd),
-			hh: checkTime(hh),
-			mm: checkTime(mm),
-			ss: checkTime(ss)
-		}
-
-		if (
-			item.conttainer.dd > 0 ||
-			item.conttainer.hh > 0 ||
-			item.conttainer.mm > 0 ||
-			item.conttainer.ss > 0
-		) {
-			item.t = setTimeout(function() {
-				round($diff - (item.speed || 1000))
-			}, item.speed || 1000)
-		}
-		// 回调
-		callback && callback(item)
-	}
-	round(diff - loadTime)
+    function round($diff) {
+        let dd = parseInt($diff / 1000 / 60 / 60 / 24, 10) // 计算剩余的天数
+        let hh = parseInt(($diff / 1000 / 60 / 60) % 24, 10) // 计算剩余的小时数
+        let mm = parseInt(($diff / 1000 / 60) % 60, 10) // 计算剩余的分钟数
+        let ss = parseInt(($diff / 1000) % 60, 10) // 计算剩余的秒数
+
+        function checkTime(_a) {
+            let a = _a
+            if (a < 10) {
+                a = '0' + a
+            }
+            return a.toString()
+        }
+
+        item.conttainer = {
+            ddhh: checkTime(dd * 24 + hh),
+            dd: checkTime(dd),
+            hh: checkTime(hh),
+            mm: checkTime(mm),
+            ss: checkTime(ss)
+        }
+
+        if (
+            item.conttainer.dd > 0 ||
+            item.conttainer.hh > 0 ||
+            item.conttainer.mm > 0 ||
+            item.conttainer.ss > 0
+        ) {
+            item.t = setTimeout(function() {
+                round($diff - (item.speed || 1000))
+            }, item.speed || 1000)
+        }
+        // 回调
+        callback && callback(item)
+    }
+    round(diff - loadTime)
 }
 }
 
 
 
 
 /* 对象循环赋值 */
 /* 对象循环赋值 */
 export function objAssign(target = {}, source = {}) {
 export function objAssign(target = {}, source = {}) {
-	for (let key in target) {
-		if (source.hasOwnProperty(key)) {
-			target[key] = source[key]
-		}
-	}
+    for (let key in target) {
+        if (source.hasOwnProperty(key)) {
+            target[key] = source[key]
+        }
+    }
 }
 }
 
 
 /* 数组去重 */
 /* 数组去重 */
 export function arrayUnique(arr) {
 export function arrayUnique(arr) {
-	if (!Array.isArray(arr)) {
-		console.log('type error!')
-		return
-	}
-	return Array.from(new Set(arr))
+    if (!Array.isArray(arr)) {
+        console.log('type error!')
+        return
+    }
+    return Array.from(new Set(arr))
+}
+
+
+/*
+ * 反序列化URL参数
+ * { age: "25", name: "Tom" }
+ */
+export function parseUrlSearch(location) {
+    return location.search
+        .replace(/(^\?)|(&$)/g, '')
+        .split('&')
+        .reduce((t, v) => {
+            const [key, val] = v.split('=')
+            t[key] = decodeURIComponent(val)
+            return t
+        }, {})
+}
+/*
+ * getQueryParams('id')
+ * 获取url上某个key的值
+ */
+export function getParam(param) {
+    // 获取浏览器参数
+    const r = new RegExp(`\\?(?:.+&)?${param}=(.*?)(?:&.*)?$`)
+    const m = window.location.toString().match(r)
+    return m ? decodeURI(m[1]) : ''
+}
+/*
+ * queryStringify
+ * 将k-v的对象序列化转成 url?k=v&k1=v1;
+ */
+export function queryStringify(search = {}) {
+    return Object.entries(search)
+        .reduce((t, v) => `${t}${v[0]}=${encodeURIComponent(v[1])}&`, '')
+        .replace(/&$/, '')
+}
+
+/*
+ * queryStringify
+ * 将url?k=v&k1=v1的序列化转成k-v对象
+ */
+export function queryParse(query = '') {
+    if (query.startsWith('?')) {
+        query = query.slice(0)
+    }
+    const obj = Object.create(null)
+    query.split('&').forEach(str => {
+        const v = str.split('=')
+        obj[v[0]] = v[1]
+    })
+    return obj
 }
 }

+ 12 - 12
components/views/cm-cart-product/cm-cart-product.vue

@@ -1,25 +1,25 @@
 <template>
 <template>
     <view class="cart-product">
     <view class="cart-product">
-        <image class="cover" :src="productInfo.mainImage" mode="widthFix"></image>
+        <image class="cover" :src="productInfo.productImage" mode="widthFix"></image>
         <view class="content">
         <view class="content">
-            <view class="name">{{ productInfo.productName }}</view>
+            <view class="name">{{ productInfo.name }}</view>
             <template v-if="isExpired">
             <template v-if="isExpired">
                 <view class="tip">商品已下架</view>
                 <view class="tip">商品已下架</view>
             </template>
             </template>
             <template v-else>
             <template v-else>
-                <view class="unit">规格:{{ productInfo.unit }}</view>
+                <view class="unit">规格:{{ productInfo.productUnit }}</view>
                 <view class="tags">
                 <view class="tags">
-                    <template v-if="tagsList.length > 0">
-                        <view class="tag other" v-for="(tag, index) in tagsList" :key="index">{{ tag }}</view>
-                    </template>
-                    <template v-if="productInfo.activeStatus">
-                        <view class="tag cx" v-if="userId === productInfo.heUserId">促销</view>
-                        <view class="tag cx" v-else>自营</view>
-                        <view class="tag hd" v-if="productInfo.ladderList.length > 0">活动价</view>
-                    </template>
+                    <!-- 拼团价  活动价  限时特价  券后价   -->
+                    <view class="tag cx" v-if="userId === productInfo.heUserId">促销</view>
+                    <view class="tag cx" v-else>自营</view>
+                    <view class="tag pt" v-if="productInfo.collageStatus > 0">拼团价</view>
+                    <view class="tag hd" v-else-if="productInfo.activeStatus > 0">活动价</view>
+                    <view class="tag other" v-else-if="productInfo.discountStatus > 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>
                 <view class="price">¥{{ productInfo.price | priceFormat }}</view>
                 <view class="price">¥{{ productInfo.price | priceFormat }}</view>
-                <cm-number-box class="numberbox" v-model="productInfo.productCount" @change="change"></cm-number-box>
+                <cm-number-box class="numberbox" v-model="productInfo.num" @change="change"></cm-number-box>
             </template>
             </template>
         </view>
         </view>
     </view>
     </view>

+ 4 - 4
components/views/cm-drag/cm-drag.vue

@@ -3,13 +3,13 @@
         id="_drag_button"
         id="_drag_button"
         class="cart-icon"
         class="cart-icon"
         :style="'left: ' + left + 'px; top:' + top + 'px;'"
         :style="'left: ' + left + 'px; top:' + top + 'px;'"
-        @touchstart="touchstart"
+        @touchstart.stop="touchstart"
         @touchmove.stop.prevent="touchmove"
         @touchmove.stop.prevent="touchmove"
-        @touchend="touchend"
+        @touchend.stop="touchend"
         @click.stop.prevent="click"
         @click.stop.prevent="click"
         :class="{ transition: isDock && !isMove }"
         :class="{ transition: isDock && !isMove }"
     >
     >
-        <text v-if="cartNum > 0" class="badge"> {{ cartNum >= 100 ? '99+' : cartNum }} </text>
+        <text v-if="cartNum > 0" class="badge">{{ cartNum >= 100 ? '99+' : cartNum }}</text>
         <text class="iconfont icon-gouwuche-mianxing"></text>
         <text class="iconfont icon-gouwuche-mianxing"></text>
     </view>
     </view>
 </template>
 </template>
@@ -144,7 +144,7 @@ export default {
         font-size: 24rpx;
         font-size: 24rpx;
         position: absolute;
         position: absolute;
         top: -10rpx;
         top: -10rpx;
-        right: 0; 
+        right: 0;
         width: 40rpx;
         width: 40rpx;
         height: 40rpx;
         height: 40rpx;
         border-radius: 50%;
         border-radius: 50%;

+ 22 - 7
components/views/cm-product/cm-product.vue

@@ -8,10 +8,18 @@
             <view class="title">{{ data.name }}</view>
             <view class="title">{{ data.name }}</view>
             <!-- 标签 -->
             <!-- 标签 -->
             <view class="tags">
             <view class="tags">
-                <!-- <view class="tag type1">自营</view> -->
-                <view class="tag pt" v-if="data.collageStatus === 1">拼团价</view>
-                <view class="tag hd" v-if="data.activeStatus == 1 && data.collageStatus === 0">活动价</view>
-                <view class="tag hd" v-if="data.couponsLogo">优惠券</view>
+                <!-- 拼团价  活动价  限时特价  券后价   -->
+                <!-- 该商品参与了商城活动 -->
+                <template v-if="isActivityProduct">
+                    <view class="tag pt" v-if="data.collageStatus > 0">拼团价</view>
+                    <view class="tag hd" v-else-if="data.activeStatus > 0">活动价</view>
+                    <view class="tag other" v-else-if="data.discountStatus > 0">限时特价</view>
+                </template>
+                <!-- 该商品未参与商城活动 -->
+                <template v-else>
+                    <view class="tag other" v-if="data.couponStatus > 1">{{ data.couponInfo }}</view>
+                    <view class="tag other" v-else-if="data.couponStatus > 0">券后价</view>
+                </template>
             </view>
             </view>
             <!-- 底部 -->
             <!-- 底部 -->
             <view class="footer">
             <view class="footer">
@@ -19,9 +27,8 @@
                 <view class="price">
                 <view class="price">
                     <view class="delete">
                     <view class="delete">
                         <text v-if="data.normalPrice">¥{{ data.normalPrice | priceFormat }}</text>
                         <text v-if="data.normalPrice">¥{{ data.normalPrice | priceFormat }}</text>
-                        <!-- <view class="delete" >¥99.00</view> -->
                     </view>
                     </view>
-                    <view>¥{{ data.price | priceFormat }}</view>
+                    <view>¥{{ showPrice | priceFormat }}</view>
                 </view>
                 </view>
                 <!-- 加入购物车 -->
                 <!-- 加入购物车 -->
                 <view
                 <view
@@ -43,6 +50,14 @@ export default {
             default: () => {}
             default: () => {}
         }
         }
     },
     },
+    computed: {
+        isActivityProduct() {
+            return this.data.collageStatus > 0 || this.data.activeStatus > 0 || this.data.discountStatus > 0
+        },
+        showPrice() {
+            return this.data.couponStatus === 1 && !this.isActivityProduct ? this.data.couponPrice : this.data.price
+        }
+    },
     methods: {
     methods: {
         // 跳转商品详情
         // 跳转商品详情
         detail() {
         detail() {
@@ -122,7 +137,7 @@ $grid: 16rpx;
             box-sizing: border-box;
             box-sizing: border-box;
             padding-right: $grid;
             padding-right: $grid;
             font-size: 26rpx;
             font-size: 26rpx;
-            font-weight: 600;
+            font-weight: 700;
             color: #f83c6c;
             color: #f83c6c;
             .delete {
             .delete {
                 height: 26rpx;
                 height: 26rpx;

+ 63 - 37
components/views/cm-share-popup/cm-share-popup.vue

@@ -38,6 +38,7 @@
 <script>
 <script>
 import { mapGetters } from 'vuex'
 import { mapGetters } from 'vuex'
 import { getUserProfile } from '@/common/auth.js'
 import { getUserProfile } from '@/common/auth.js'
+import { generateWxUnlimited } from '@/common/share.helper.js'
 export default {
 export default {
     props: {
     props: {
         title: {
         title: {
@@ -52,7 +53,7 @@ export default {
             type: String,
             type: String,
             default: 'normal',
             default: 'normal',
             validator: value => {
             validator: value => {
-                return ['product', 'normal'].indexOf(value) > -1
+                return ['product', 'normal', 'activity'].indexOf(value) > -1
             }
             }
         }
         }
     },
     },
@@ -63,13 +64,15 @@ export default {
             posterUrl: '',
             posterUrl: '',
             // 海报数据信息
             // 海报数据信息
             posterData: {
             posterData: {
-                avatar: '',
-                username: '',
-                porductName: '',
-                productPrice: '',
-                productOriginPrice: '',
-                productImage: '',
-                qrCodeImage: ''
+                query: '', // 查询参数字符串
+                path: '', // 页面路径
+                avatar: '', // 用户头像
+                username: '', // 用户名
+                porductName: '', // 产品名
+                productPrice: '', // 产品价格
+                productOriginPrice: '', // 产品原价
+                productImage: '', // 产品图片
+                qrCodeImage: '' //页面二维码,小程序二维码
             }
             }
         }
         }
     },
     },
@@ -85,23 +88,33 @@ export default {
         // 下载图片任务
         // 下载图片任务
         async downLoadImageTask() {
         async downLoadImageTask() {
             const { avatar, productImage, qrCodeImage } = this.posterData
             const { avatar, productImage, qrCodeImage } = this.posterData
-            // 图片资源链接
+            // 背景图片
             const bgImageUrl = this.staticUrl + 'bg-share-01.png'
             const bgImageUrl = this.staticUrl + 'bg-share-01.png'
+            // 用户头像
             const avatarUrl = avatar || this.staticUrl + 'icon-join-us.png'
             const avatarUrl = avatar || this.staticUrl + 'icon-join-us.png'
+            // 分享封面
             let coverUrl = productImage || this.staticUrl + 'icon-share.png'
             let coverUrl = productImage || this.staticUrl + 'icon-share.png'
+            // 分享二维码
             let ewmUrl = qrCodeImage || this.staticUrl + 'icon-ewm-hehe.jpg'
             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'
-            }
 
 
             // 下载图片任务
             // 下载图片任务
-            const taskList = [
-                this.downloadImage(bgImageUrl),
-                this.downloadImage(avatarUrl),
-                this.downloadImage(coverUrl),
-                this.downloadImage(ewmUrl)
-            ]
+            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({
+                        pagePath: this.posterData.path,
+                        queryStr: this.posterData.query
+                    })
+                )
+            }
 
 
             // 执行下载图片
             // 执行下载图片
             try {
             try {
@@ -109,6 +122,12 @@ export default {
                 this.drawPoster()
                 this.drawPoster()
             } catch (e) {
             } catch (e) {
                 console.log(e)
                 console.log(e)
+                // this.$toast('分享失败,请换用其它分享方式')
+                uni.showToast({
+                    title: JSON.stringify(e),
+                    duration: 10000
+                })
+                this.$refs.sharePopup.close()
             }
             }
         },
         },
 
 
@@ -180,6 +199,8 @@ export default {
             let txt = '强烈为你推荐该商城'
             let txt = '强烈为你推荐该商城'
             if (this.type === 'product') {
             if (this.type === 'product') {
                 txt = '强烈为你推荐该商品'
                 txt = '强烈为你推荐该商品'
+            } else if (this.type === 'activity') {
+                txt = '强烈为你推荐该活动'
             }
             }
             ctx.fillText(txt, 146 * scale, (87 + 24) * scale, 350 * scale)
             ctx.fillText(txt, 146 * scale, (87 + 24) * scale, 350 * scale)
         },
         },
@@ -201,31 +222,36 @@ export default {
         drawGoodsInfo(ctx, scale) {
         drawGoodsInfo(ctx, scale) {
             // 参数处理
             // 参数处理
             let { porductName, productPrice, productOriginPrice } = this.posterData
             let { porductName, productPrice, productOriginPrice } = this.posterData
-            productPrice = productPrice.toFixed(2)
-            if (productOriginPrice) {
-                productOriginPrice = '¥' + productOriginPrice.toFixed(2)
-            }
-            const porductNames = this.getProductNames(porductName)
 
 
+            const porductNames = this.getProductNames(porductName)
             console.log(porductNames)
             console.log(porductNames)
 
 
             // 绘制中心图片
             // 绘制中心图片
             ctx.drawImage(this.imageList[2].tempFilePath, 40 * scale, 174 * scale, 460 * scale, 460 * scale)
             ctx.drawImage(this.imageList[2].tempFilePath, 40 * scale, 174 * scale, 460 * scale, 460 * scale)
-            // 绘制价格符号
-            ctx.setFillStyle('#FF457B')
-            ctx.setFontSize(24 * scale)
-            ctx.fillText('¥', 40 * scale, (680 + 24) * scale)
-            // 绘制购买价格
-            ctx.setFontSize(40 * scale)
-            ctx.fillText(productPrice, 62 * scale, (665 + 40) * scale)
-            // 绘制原价
-            if (productOriginPrice) {
-                ctx.setFillStyle('#999')
+
+            if (this.type === 'product') {
+                productPrice = productPrice.toFixed(2)
+                if (productOriginPrice) {
+                    productOriginPrice = '¥' + productOriginPrice.toFixed(2)
+                }
+
+                // 绘制价格符号
+                ctx.setFillStyle('#FF457B')
                 ctx.setFontSize(24 * scale)
                 ctx.setFontSize(24 * scale)
-                ctx.fillText(productOriginPrice, 200 * scale, (680 + 24) * scale)
-                let m = ctx.measureText(productOriginPrice)
-                ctx.fillRect(200 * scale, (680 + 16) * scale, parseInt(m.width), 1)
+                ctx.fillText('¥', 40 * scale, (680 + 24) * scale)
+                // 绘制购买价格
+                ctx.setFontSize(40 * scale)
+                ctx.fillText(productPrice, 62 * scale, (665 + 40) * scale)
+                // 绘制原价
+                if (productOriginPrice) {
+                    ctx.setFillStyle('#999')
+                    ctx.setFontSize(24 * scale)
+                    ctx.fillText(productOriginPrice, 200 * scale, (680 + 24) * scale)
+                    let m = ctx.measureText(productOriginPrice)
+                    ctx.fillRect(200 * scale, (680 + 16) * scale, parseInt(m.width), 1)
+                }
             }
             }
+
             // 绘制商品标题
             // 绘制商品标题
             ctx.setFillStyle('#333')
             ctx.setFillStyle('#333')
             ctx.setFontSize(26 * scale)
             ctx.setFontSize(26 * scale)

+ 8 - 2
pages.json

@@ -56,13 +56,13 @@
                 "path": "activity-area",
                 "path": "activity-area",
                 "style": {
                 "style": {
                     "navigationBarTitleText": "活动专区",
                     "navigationBarTitleText": "活动专区",
-                    "enablePullDownRefresh": true
+                    "enablePullDownRefresh": false
                 }
                 }
             }, {
             }, {
                 "path": "activity-detail",
                 "path": "activity-detail",
                 "style": {
                 "style": {
                     "navigationBarTitleText": "活动详情",
                     "navigationBarTitleText": "活动详情",
-                    "enablePullDownRefresh": true
+                    "enablePullDownRefresh": false 
                 }
                 }
             }]
             }]
         },
         },
@@ -168,6 +168,12 @@
                     "navigationBarTitleText": "订单详情",
                     "navigationBarTitleText": "订单详情",
                     "enablePullDownRefresh": false
                     "enablePullDownRefresh": false
                 }
                 }
+            }, {
+                "path": "order-pay",
+                "style": {
+                    "navigationBarTitleText": "订单支付",
+                    "enablePullDownRefresh": false
+                }
             }, {
             }, {
                 "path": "order-list",
                 "path": "order-list",
                 "style": {
                 "style": {

+ 13 - 3
pages/index/index.vue

@@ -5,28 +5,34 @@
 <script>
 <script>
 import { mapActions, mapMutations } from 'vuex'
 import { mapActions, mapMutations } from 'vuex'
 import shareEntry from './mixins/share-entry.js'
 import shareEntry from './mixins/share-entry.js'
+
 // 页面初始化
 // 页面初始化
 export default {
 export default {
     mixins: [shareEntry],
     mixins: [shareEntry],
     data() {
     data() {
         return {
         return {
+            scene: '',
             state_str: ''
             state_str: ''
         }
         }
     },
     },
     onLoad(options) {
     onLoad(options) {
+        this.scene = options.scene
         this.state_str = options.state_str
         this.state_str = options.state_str
         this.init()
         this.init()
     },
     },
     methods: {
     methods: {
         ...mapMutations('user', ['SET_USER_INFO']),
         ...mapMutations('user', ['SET_USER_INFO']),
-        ...mapActions('user', ['wxAutoLogin']),
+        ...mapActions('user', ['wxAutoLogin', 'getAccessToken']),
         ...mapActions('coupon', ['initCouponCount']),
         ...mapActions('coupon', ['initCouponCount']),
         ...mapActions('cart', ['fetchCartKindCount']),
         ...mapActions('cart', ['fetchCartKindCount']),
+
         async init() {
         async init() {
+            await this.getAccessToken()
             await this.initUserInfo()
             await this.initUserInfo()
             await this.initCouponCount()
             await this.initCouponCount()
             await this.fetchCartKindCount()
             await this.fetchCartKindCount()
         },
         },
+
         // 初始化用户信息
         // 初始化用户信息
         async initUserInfo() {
         async initUserInfo() {
             this.$setStorage('ENTRY_MARK_TYPE', 'YES')
             this.$setStorage('ENTRY_MARK_TYPE', 'YES')
@@ -48,9 +54,13 @@ export default {
         },
         },
         // 跳转入口页面
         // 跳转入口页面
         redirectToEntry() {
         redirectToEntry() {
-            if (this.state_str) {
-                this.shareHandle(this.state_str)
+            if (this.scene) {
+                // 处理分享信息
+                this.shareHandle(this.scene, 'scene')
+            } else if (this.state_str) {
+                this.shareHandle(this.state_str, 'state_str')
             } else {
             } else {
+                // 默认调整首页
                 this.$router.switchTab('home')
                 this.$router.switchTab('home')
             }
             }
         }
         }

+ 29 - 19
pages/index/mixins/share-entry.js

@@ -1,3 +1,6 @@
+import { enCodeQueryStr } from '@/common/share.helper.js'
+import { queryParse } from '@/common/utils.js'
+
 const shareEntry = {
 const shareEntry = {
     data() {
     data() {
         return {
         return {
@@ -15,37 +18,44 @@ const shareEntry = {
     },
     },
     methods: {
     methods: {
         // 处理分享参数
         // 处理分享参数
-        shareHandle(state_str) {
-            if (!state_str) return
-            state_str = decodeURIComponent(state_str)
-            try {
-                const decrypt = this.$crypto.decrypt(state_str)
-                // 解密参数
+        shareHandle(query, type) {
+            if (!query) return;
+            console.log(query)
+            // 小程序分享
+            if (type === 'state_str') {
                 this.shareData = {
                 this.shareData = {
                     ...this.shareData,
                     ...this.shareData,
-                    ...JSON.parse(decrypt)
+                    ...JSON.parse(this.$crypto.decrypt(decodeURIComponent(query)))
                 }
                 }
-                // 保存分享者的用户id
-                if (this.shareData.inviteUserId) {
-                    this.$store.commit('SET_INVITE_USER_ID', this.shareData.inviteUserId)
+            } else if (type === 'scene') {
+                this.shareData = {
+                    ...this.shareData,
+                    ...queryParse(enCodeQueryStr(decodeURIComponent(query)))
                 }
                 }
+            } else {
+                return this.$router.switchTab('home')
+            }
 
 
-                this.shareData.type = parseInt(this.shareData.type)
-                this.jumpTopSharePage()
-            } catch (e) {
-                return
+            // 保存分享者的用户id
+            if (this.shareData.inviteUserId) {
+                this.$store.commit('user/SET_INVITE_USER_ID', this.shareData.inviteUserId)
             }
             }
+
+            console.log(this.shareData);
+
+            this.shareData.type = parseInt(this.shareData.type)
+            this.jumpTopSharePage()
         },
         },
 
 
         // 跳转到对应的分享页面
         // 跳转到对应的分享页面
         jumpTopSharePage() {
         jumpTopSharePage() {
-            const { type = 0, collageId, jumpState, productId, dealerUserId, keyWord } = this.shareData
+            const { type = 0, collageId, jumpState, productId, activityId, dealerUserId, keyWord } = this.shareData
             const path = {
             const path = {
                 0: 'home', //首页
                 0: 'home', //首页
-                1: `goods/goods-detail?jumpState=${jumpState}&productId=${productId}`, //商品详情
-                2: `goods/goods-search?keyWord=${keyWord}`, // 搜索页面
-                3: `activity/activity-detail?dealerUserId=${dealerUserId}`, //活动商品列表
-                4: `share-buy/share-buy-entry?collageId=${collageId}` // 拼团分享
+                1: `goods/goods-detail?type=share&jumpState=${jumpState}&productId=${productId}`, //商品详情
+                // 2: `goods/goods-search?keyWord=${keyWord}`, // 搜索页面
+                3: `activity/activity-detail?type=share&activityId=${activityId}&dealerUserId=${dealerUserId}`, //活动商品列表
+                4: `share-buy/share-buy-entry?type=share&collageId=${collageId}` // 拼团分享
             }
             }
 
 
             if (type === 0) {
             if (type === 0) {

+ 47 - 176
pages/tabBar/category/category.vue

@@ -1,30 +1,33 @@
 <template>
 <template>
     <view class="category">
     <view class="category">
-        <!-- 侧边导航 -->
-        <scroll-view class="slide-navbar" :scroll-y="true">
-            <template v-for="(item, index) in navbar">
-                <view
-                    class="slide"
-                    :class="{ active: index === current }"
-                    :key="item.id"
-                    v-text="item.name"
-                    @click="onClick(item, index)"
-                ></view>
-            </template>
-        </scroll-view>
-        <!-- 右侧容器 -->
-        <scroll-view
-            class="panel"
-            :scroll-y="true"
-            :scroll-with-animation="true"
-            :scroll-top="scrollTop"
-            @scroll="onScroll"
-        >
-            <view class="cate" v-for="cate in categories" :key="cate.id">
-                <image class="cate-icon" :src="cate.image"></image>
-                <view class="cate-name" v-text="cate.name"></view>
-            </view>
-        </scroll-view>
+        <tui-skeleton v-if="isRequest" :loadingType="3" :isLoading="true"></tui-skeleton>
+        <template v-else>
+            <!-- 侧边导航 -->
+            <scroll-view class="slide-navbar" :scroll-y="true">
+                <template v-for="(item, index) in categories">
+                    <view
+                        class="slide"
+                        :class="{ active: index === current }"
+                        :key="item.id"
+                        v-text="item.name"
+                        @click="onClick(item, index)"
+                    ></view>
+                </template>
+            </scroll-view>
+            <!-- 右侧容器 -->
+            <scroll-view
+                class="panel"
+                :scroll-y="true"
+                :scroll-with-animation="true"
+                :scroll-top="scrollTop"
+                @scroll="onScroll"
+            >
+                <view class="cate" v-for="(item, index) in smallTypeList" :key="index" @click="toGoodsFloor(item)">
+                    <image class="cate-icon" :src="item.crmIcon"></image>
+                    <view class="cate-name" v-text="item.name"></view>
+                </view>
+            </scroll-view>
+        </template>
     </view>
     </view>
 </template>
 </template>
 
 
@@ -33,158 +36,19 @@ import { fetchProductTypeFirst, fetchProductTypeSecond } from '@/services/api/go
 export default {
 export default {
     data() {
     data() {
         return {
         return {
-            categories: [
-                {
-                    id: 1,
-                    name: '防晒霜',
-                    image: 'https://picsum.photos/200/200?random=1'
-                },
-                {
-                    id: 2,
-                    name: '防晒霜',
-                    image: 'https://picsum.photos/200/200?random=2'
-                },
-                {
-                    id: 3,
-                    name: '防晒霜',
-                    image: 'https://picsum.photos/200/200?random=3'
-                },
-                {
-                    id: 4,
-                    name: '防晒霜',
-                    image: 'https://picsum.photos/200/200?random=4'
-                },
-                {
-                    id: 6,
-                    name: '防晒霜',
-                    image: 'https://picsum.photos/200/200?random=4'
-                },
-                {
-                    id: 5,
-                    name: '防晒霜',
-                    image: 'https://picsum.photos/200/200?random=4'
-                },
-                {
-                    id: 7,
-                    name: '防晒霜',
-                    image: 'https://picsum.photos/200/200?random=4'
-                },
-                {
-                    id: 8,
-                    name: '防晒霜',
-                    image: 'https://picsum.photos/200/200?random=4'
-                },
-                {
-                    id: 9,
-                    name: '防晒霜',
-                    image: 'https://picsum.photos/200/200?random=4'
-                },
-                {
-                    id: 10,
-                    name: '防晒霜',
-                    image: 'https://picsum.photos/200/200?random=4'
-                },
-                {
-                    id: 11,
-                    name: '防晒霜',
-                    image: 'https://picsum.photos/200/200?random=4'
-                },
-                {
-                    id: 12,
-                    name: '防晒霜',
-                    image: 'https://picsum.photos/200/200?random=4'
-                },
-                {
-                    id: 13,
-                    name: '防晒霜',
-                    image: 'https://picsum.photos/200/200?random=4'
-                },
-                {
-                    id: 14,
-                    name: '防晒霜',
-                    image: 'https://picsum.photos/200/200?random=4'
-                },
-                {
-                    id: 15,
-                    name: '防晒霜',
-                    image: 'https://picsum.photos/200/200?random=4'
-                },
-                {
-                    id: 16,
-                    name: '防晒霜',
-                    image: 'https://picsum.photos/200/200?random=4'
-                },
-                {
-                    id: 17,
-                    name: '防晒霜',
-                    image: 'https://picsum.photos/200/200?random=4'
-                },
-                {
-                    id: 18,
-                    name: '防晒霜',
-                    image: 'https://picsum.photos/200/200?random=4'
-                },
-                {
-                    id: 19,
-                    name: '防晒霜',
-                    image: 'https://picsum.photos/200/200?random=4'
-                },
-                {
-                    id: 20,
-                    name: '防晒霜',
-                    image: 'https://picsum.photos/200/200?random=4'
-                },
-                {
-                    id: 21,
-                    name: '防晒霜',
-                    image: 'https://picsum.photos/200/200?random=4'
-                },
-                {
-                    id: 22,
-                    name: '防晒霜',
-                    image: 'https://picsum.photos/200/200?random=4'
-                },
-                {
-                    id: 23,
-                    name: '防晒霜',
-                    image: 'https://picsum.photos/200/200?random=4'
-                }
-            ],
-            navbar: [
-                {
-                    name: '中胚层产品',
-                    id: 1
-                },
-                {
-                    name: '抗衰除皱',
-                    id: 2
-                },
-                {
-                    name: '术后修复',
-                    id: 3
-                },
-                {
-                    name: 'SPA产品',
-                    id: 4
-                },
-                {
-                    name: '面部护理',
-                    id: 5
-                },
-                {
-                    name: '耗材',
-                    id: 6
-                },
-                {
-                    name: '临期产品',
-                    id: 7
-                }
-            ],
-            current: 1,
+            isRequest: true,
+            categories: [],
+            current: 0,
             oldScrollTop: 0,
             oldScrollTop: 0,
             scrollTop: 100
             scrollTop: 100
         }
         }
     },
     },
+    computed: {
+        smallTypeList() {
+            const current = this.categories[this.current]
+            return (current && current.smallTypeList) || []
+        }
+    },
     onShow() {
     onShow() {
         this.fetchProductTypeFirst()
         this.fetchProductTypeFirst()
     },
     },
@@ -205,14 +69,21 @@ export default {
         async fetchProductTypeFirst() {
         async fetchProductTypeFirst() {
             try {
             try {
                 const { data } = await fetchProductTypeFirst()
                 const { data } = await fetchProductTypeFirst()
-                console.log(data)
+                this.categories = data
+                this.isRequest = false
             } catch (e) {
             } catch (e) {
                 console.log(e)
                 console.log(e)
             }
             }
         },
         },
 
 
-        // 获取二级商品分了列表
-        fetchProductTypeSecond() {}
+        // 商品楼层
+        toGoodsFloor(item) {
+            this.$setStorage('NAVBAR', {
+                type: 'second',
+                id: item.smallTypeId
+            })
+            this.$router.navigateTo('goods/goods-list')
+        }
     }
     }
 }
 }
 </script>
 </script>

+ 17 - 3
pages/tabBar/home/home.vue

@@ -48,6 +48,7 @@
 
 
 <script>
 <script>
 import { fetchHomeCarousel, fetchHomeNavbar, fetchHomeFloorData, fetchHomeCouponList } from '@/services/api/home.js'
 import { fetchHomeCarousel, fetchHomeNavbar, fetchHomeFloorData, fetchHomeCouponList } from '@/services/api/home.js'
+import { fetchCouponDisplay } from '@/services/api/coupon.js'
 import { fetchProductFloorList } from '@/services/api/goods.js'
 import { fetchProductFloorList } from '@/services/api/goods.js'
 import { shareDataResult } from '@/common/share.helper.js'
 import { shareDataResult } from '@/common/share.helper.js'
 import { mapActions, mapGetters } from 'vuex'
 import { mapActions, mapGetters } from 'vuex'
@@ -62,11 +63,12 @@ export default {
             floorList: [],
             floorList: [],
             couponList: [],
             couponList: [],
             current: 0,
             current: 0,
-            isRefresh: false
+            isRefresh: false,
+            couponTipStr: ''
         }
         }
     },
     },
     computed: {
     computed: {
-        ...mapGetters(['userId'])
+        ...mapGetters(['userId', 'accessToken'])
     },
     },
     onPullDownRefresh() {
     onPullDownRefresh() {
         this.initHomeInfo()
         this.initHomeInfo()
@@ -180,6 +182,7 @@ export default {
         // 获取优惠券列表
         // 获取优惠券列表
         async fetchCouponList() {
         async fetchCouponList() {
             try {
             try {
+                this.fetchCouponDisplay() // 获取可领取优惠券类型
                 const resultCouponData = await fetchHomeCouponList({ userId: this.userId })
                 const resultCouponData = await fetchHomeCouponList({ userId: this.userId })
                 this.couponList = [
                 this.couponList = [
                     ...resultCouponData.data.map(item => {
                     ...resultCouponData.data.map(item => {
@@ -193,9 +196,19 @@ export default {
             }
             }
         },
         },
 
 
+        // 获取可领取优惠券类型
+        async fetchCouponDisplay() {
+            try {
+                const res = await fetchCouponDisplay({ userId: this.userId })
+                this.couponTipStr = res.data
+            } catch (e) {
+                console.log('获取优惠券类型失败')
+            }
+        },
+
         // 生成优惠券说明
         // 生成优惠券说明
         generateCouponTips() {
         generateCouponTips() {
-            return [
+            const result = [
                 {
                 {
                     type: 'tip',
                     type: 'tip',
                     id: 1,
                     id: 1,
@@ -212,6 +225,7 @@ export default {
                     name: '分享券福利'
                     name: '分享券福利'
                 }
                 }
             ]
             ]
+            return result.filter(item => this.couponTipStr.indexOf(item.id.toString()) > -1)
         }
         }
     }
     }
 }
 }

+ 113 - 73
pages/views/activity/activity-detail.vue

@@ -1,6 +1,6 @@
 <template>
 <template>
     <view class="container activity">
     <view class="container activity">
-        <view class="activity-banner"> <image class="activity-banner-image" :src="activityBanner"></image> </view>
+        <view class="activity-banner"><image class="activity-banner-image" :src="activityBanner"></image></view>
         <!-- 商品列表 -->
         <!-- 商品列表 -->
         <view class="container-section clearfix">
         <view class="container-section clearfix">
             <view class="product-list" v-for="(pro, index) in productList" :key="index" @click.stop="detail(pro)">
             <view class="product-list" v-for="(pro, index) in productList" :key="index" @click.stop="detail(pro)">
@@ -9,11 +9,13 @@
                 </view>
                 </view>
                 <view class="product-list-msg">
                 <view class="product-list-msg">
                     <view class="product-msg-name">{{ pro.name }}</view>
                     <view class="product-msg-name">{{ pro.name }}</view>
-                    <view class="product-list-tag" v-if="pro.activeStatus === 1">
-                        <text class="tag tag-03" v-if="pro.collageStatus === 1">拼团价</text>
-                        <!-- <text class="tag tag-01">促销</text> -->
-                        <text class="tag tag-02" v-if="pro.collageStatus === 0">活动价</text>
-                        <text class="tag tag-02" v-if="pro.couponsLogo">优惠券</text>
+                    <view class="product-list-tag tags" v-if="pro.activeStatus === 1">
+                        <!-- 拼团价  活动价  限时特价  券后价   -->
+                        <view class="tag pt" v-if="pro.collageStatus > 0">拼团价</view>
+                        <view class="tag hd" v-else-if="pro.activeStatus > 0">活动价</view>
+                        <view class="tag other" v-else-if="pro.discountStatus > 0">限时特价</view>
+                        <view class="tag other" v-else-if="pro.couponStatus > 1">{{ pro.couponInfo }}</view>
+                        <view class="tag other" v-else-if="pro.couponStatus > 0">券后价</view>
                     </view>
                     </view>
                     <view class="product-list-pri">
                     <view class="product-list-pri">
                         <view class="price">
                         <view class="price">
@@ -21,7 +23,7 @@
                             <text class="delete">¥{{ pro.price | priceFormat }}</text>
                             <text class="delete">¥{{ pro.price | priceFormat }}</text>
                         </view>
                         </view>
                         <view class="carts" @click.stop="handAddCarts(pro)">
                         <view class="carts" @click.stop="handAddCarts(pro)">
-                            <view class="carts-add"> <text class="iconfont icon-gouwuche"></text> </view>
+                            <view class="carts-add"><text class="iconfont icon-gouwuche"></text></view>
                         </view>
                         </view>
                     </view>
                     </view>
                 </view>
                 </view>
@@ -34,42 +36,51 @@
             backgroundColor="#ff457b"
             backgroundColor="#ff457b"
         ></cm-loadmore>
         ></cm-loadmore>
         <!-- 可拖动悬浮按钮 -->
         <!-- 可拖动悬浮按钮 -->
-        <cm-drag :cartNum="kindCount" :isDock="true" :existTabBar="true" @btnClick="btnClick"> </cm-drag>
+        <cm-drag :cartNum="kindCount" :isDock="true" :existTabBar="true" @btnClick="btnClick"></cm-drag>
+
+        <!-- 分享弹窗 -->
+        <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>
     </view>
     </view>
 </template>
 </template>
 
 
 <script>
 <script>
-import { fetchProductActivityDetail } from '@/services/api/goods.js'
+import { fetchProductList } from '@/services/api/goods.js'
+import { debounce, queryStringify } from '@/common/utils.js'
+import { makeQuery } from '@/pages/views/goods/config/config.js'
 import { mapGetters, mapActions } from 'vuex'
 import { mapGetters, mapActions } from 'vuex'
 
 
 export default {
 export default {
     data() {
     data() {
         return {
         return {
+            isRefresh: true,
+            isLoading: false, // 正在加载更多
             activityBanner: '',
             activityBanner: '',
-            cartNum: 0,
-            listQuery: {
-                activityId: 0,
-                userId: 0,
-                pageNum: 1,
-                pageSize: 10
-            },
+            listQuery: makeQuery(),
             activityName: '',
             activityName: '',
-            hasNextPage: false,
             productList: [], //商品列表
             productList: [], //商品列表
-            isRefresh: false,
-            isLoading: false // 正在加载更多
+            total: 0,
+            hasNextPage: false,
+            posterData: {},
+            scrollTop: 0,
+            type: 'other'
         }
         }
     },
     },
     onLoad(option) {
     onLoad(option) {
-        // 如果是从分享链接进入的,就通过分享者id查询活动内容
+        this.listQuery.activityId = option.activityId
+        this.listQuery.userId = this.userId
         if (option.type === 'share') {
         if (option.type === 'share') {
-            this.listQuery.userId = option.userId
-        } else {
-            this.listQuery.userId = this.userId
+            this.type = option.type
+            this.listQuery.userId = option.dealerUserId
         }
         }
-        this.listQuery.activityId = option.activityId
+        this.listQuery.listType = 6
         this.activityName = option.name
         this.activityName = option.name
-        this.getProductActivityDetails()
+        this.fetchProductList()
     },
     },
     computed: {
     computed: {
         ...mapGetters(['userId', 'kindCount']),
         ...mapGetters(['userId', 'kindCount']),
@@ -77,74 +88,82 @@ export default {
             return this.productList.length > this.listQuery.pageSize
             return this.productList.length > this.listQuery.pageSize
         }
         }
     },
     },
+    onPageScroll(e) {
+        this.scrollTop = e.scrollTop
+    },
+    onShareAppMessage() {
+        // 加密
+        const state_str = encodeURIComponent(
+            this.$crypto.encrypt({
+                type: 3,
+                activityId: this.listQuery.activityId,
+                dealerUserId: this.userId
+            })
+        )
+        return {
+            title: this.activityName,
+            path: `/pages/index/index?state_str=${state_str}`,
+            imageUrl: this.activityBanner
+        }
+    },
     methods: {
     methods: {
         ...mapActions('cart', ['addToCart']),
         ...mapActions('cart', ['addToCart']),
-        // 获取活动信息
-        async getProductActivityDetails() {
-            this.isLoading = true
+        // 分享事件
+        onShare() {
+            this.posterData = {
+                query: queryStringify({
+                    type: 3,
+                    activityId: this.listQuery.activityId,
+                    dealerUserId: this.userId
+                }),
+                productImage: this.activityBanner,
+                porductName: this.activityName
+            }
+            this.$refs.sharePopup.open()
+        },
+        // 获取商品列表
+        fetchProductList: debounce(async function() {
             try {
             try {
-                const { data } = await fetchProductActivityDetail(this.listQuery)
-                this.activityBanner = data.image || `${this.staticUrl}banner.png`
-                this.hasNextPage = data.pageInfo.hasNextPage
-                if (this.isRefresh) {
-                    this.productList = data.pageInfo.list
+                if (this.listQuery.sortType === 1) {
+                    this.listQuery.productIds = this.productList.map(item => item.productId).join(',')
                 } else {
                 } else {
-                    this.productList = [...this.productList, ...data.pageInfo.list]
+                    this.listQuery.productIds = ''
                 }
                 }
-            } catch (e) {
-                console.log(e)
-            } finally {
+                const { data } = await fetchProductList(this.listQuery)
+                // 活动banner
+                this.activityBanner = data.activityBanner
+                // 产品相关
+                this.productList = [...this.productList, ...data.pageInfo.results]
+                this.hasNextPage = data.pageInfo.hasNextPage
+                this.total = data.pageInfo.totalRecord
+                // 页面状态
+                this.listQuery.pageNum++
+                this.isRequest = false
                 this.isLoading = false
                 this.isLoading = false
-                if (this.isRefresh) {
-                    setTimeout(() => {
-                        uni.stopPullDownRefresh()
-                    }, 500)
-                    this.isRefresh = false
-                }
+            } catch (e) {
+                console.log('获取商品列表失败')
             }
             }
-        },
+        }, 200),
+
+        // 查单详情
         detail(pro) {
         detail(pro) {
             this.$router.navigateTo(`goods/goods-detail?productId=${pro.productId}&jumpState=2`)
             this.$router.navigateTo(`goods/goods-detail?productId=${pro.productId}&jumpState=2`)
         },
         },
+
+        // 加入购物车
         handAddCarts(pro) {
         handAddCarts(pro) {
             this.addToCart({ productId: pro.productId, heUserId: this.userId })
             this.addToCart({ productId: pro.productId, heUserId: this.userId })
         },
         },
+
+        // 跳转购物车
         btnClick() {
         btnClick() {
             this.$router.navigateTo('cart/cart')
             this.$router.navigateTo('cart/cart')
         }
         }
-    },
-    onPullDownRefresh() {
-        //下拉刷新
-        this.isRefresh = true
-        this.listQuery.pageNum = 1
-        this.getProductActivityDetails()
-    },
-    onReachBottom() {
-        if (this.hasNextPage) {
-            this.listQuery.pageNum++
-            this.getProductActivityDetails()
-        }
-    },
-    onShareAppMessage(res) {
-        // 加密参数
-        const shareData = {
-            type: 0,
-            inviteUserId: this.userId,
-            activityId: this.listQuery.activityId,
-            userId: this.userId
-        }
-        // 加密
-        const state_str = encodeURIComponent(this.$crypto.encrypt(shareData))
-        return {
-            title: `${this.activityName}`,
-            path: `/pages/tabBar/index/index?state_str=${state_str}`,
-            imageUrl: 'https://static.caimei365.com/app/mini-hehe/icon/icon-index-share.jpg'
-        }
     }
     }
 }
 }
 </script>
 </script>
 
 
-<style lang="scss">
+<style lang="scss" scoped>
 page {
 page {
     height: auto !important;
     height: auto !important;
     background-color: #f83c6c;
     background-color: #f83c6c;
@@ -160,6 +179,27 @@ page {
         display: block;
         display: block;
     }
     }
 }
 }
+
+.share-button {
+    @extend .cm-flex-center;
+    position: fixed;
+    right: 30rpx;
+    bottom: 120rpx;
+    flex-direction: column;
+    z-index: 98;
+    width: 96rpx;
+    height: 96rpx;
+    border-radius: 50%;
+    background: rgba(0, 0, 0, 0.2);
+    .label {
+        font-size: 20rpx;
+        color: #fff;
+    }
+    .iconfont {
+        color: #fff;
+    }
+}
+
 .container-section {
 .container-section {
     width: 100%;
     width: 100%;
     height: auto;
     height: auto;

+ 1 - 1
pages/views/coupon/coupon-receive.vue

@@ -14,7 +14,7 @@
             </view>
             </view>
         </view>
         </view>
         <!-- 优惠券说明 -->
         <!-- 优惠券说明 -->
-        <coupon-desc-entry @click="toDescDetail"></coupon-desc-entry>
+        <coupon-desc-entry @click="toDescDetail" v-if="userId"></coupon-desc-entry>
         <!-- 加载更多 -->
         <!-- 加载更多 -->
         <cm-loadmore :hasMore="hasNextPage" :isLoading="isLoading" :visiable="visiable"></cm-loadmore>
         <cm-loadmore :hasMore="hasNextPage" :isLoading="isLoading" :visiable="visiable"></cm-loadmore>
         <!-- 占位 -->
         <!-- 占位 -->

+ 1 - 1
pages/views/coupon/coupon-user.vue

@@ -42,7 +42,7 @@
                         </template>
                         </template>
                     </view>
                     </view>
                     <!-- 优惠券说明 -->
                     <!-- 优惠券说明 -->
-                    <coupon-desc-entry @click="toDescDetail"></coupon-desc-entry>
+                    <!-- <coupon-desc-entry @click="toDescDetail"></coupon-desc-entry> -->
                     <cm-loadmore :hasMore="hasNextPage" :isLoading="isLoading" :visiable="visiable"></cm-loadmore>
                     <cm-loadmore :hasMore="hasNextPage" :isLoading="isLoading" :visiable="visiable"></cm-loadmore>
                     <view style="height: 140rpx;"></view>
                     <view style="height: 140rpx;"></view>
                 </scroll-view>
                 </scroll-view>

+ 6 - 3
pages/views/goods/components/goods-activity-popup/goods-activity-popup.vue

@@ -4,10 +4,13 @@
             <view class="activity-price" :style="{ paddingBottom: safeArea ? 0 : '32rpx' }">
             <view class="activity-price" :style="{ paddingBottom: safeArea ? 0 : '32rpx' }">
                 <view class="close iconfont icon-iconfontguanbi" @click="close"></view>
                 <view class="close iconfont icon-iconfontguanbi" @click="close"></view>
                 <view class="popup-content">
                 <view class="popup-content">
-                    <view class="row th"> <view class="label">购买数</view> <view class="content">价格</view> </view>
+                    <view class="row th">
+                        <view class="label">购买数</view>
+                        <view class="content">价格(元)</view>
+                    </view>
                     <view class="row" v-for="(item, index) in ladderList" :key="index">
                     <view class="row" v-for="(item, index) in ladderList" :key="index">
-                        <view class="label" v-text="item.buyNum"></view>
-                        <view class="content" v-text="item.buyPrice"></view>
+                        <view class="label">{{ item.buyNum }}</view>
+                        <view class="content">{{ item.buyPrice | priceFormat }}</view>
                     </view>
                     </view>
                 </view>
                 </view>
             </view>
             </view>

+ 1 - 1
pages/views/goods/components/goods-navbar/goods-navbar.vue

@@ -16,7 +16,7 @@
 					<!-- 购物车 -->
 					<!-- 购物车 -->
 					<view class="iconfont icon-gouwuche"></view>
 					<view class="iconfont icon-gouwuche"></view>
 					<view class="label">购物车</view>
 					<view class="label">购物车</view>
-					<view class="badge" v-text="kindCount"></view>
+					<view class="badge" v-text="kindCount" v-if="kindCount > 0"></view>
 				</view>
 				</view>
 			</view>
 			</view>
 			<view class="navbar-right">
 			<view class="navbar-right">

+ 29 - 4
pages/views/goods/components/goods-receive-buy-popup/goods-receive-buy-popup.vue

@@ -11,7 +11,8 @@
                         <view class="row">
                         <view class="row">
                             <view class="count">
                             <view class="count">
                                 <view class="label">数量</view>
                                 <view class="label">数量</view>
-                                <cm-number-box class="number-box" v-model="count"></cm-number-box>
+                                <cm-number-box class="number-box" v-model="count" :max="limitedNum"></cm-number-box>
+                                {{ limitedNum }}
                             </view>
                             </view>
                             <view
                             <view
                                 class="clickable"
                                 class="clickable"
@@ -24,7 +25,7 @@
                         <!-- 单价 -->
                         <!-- 单价 -->
                         <view class="row">
                         <view class="row">
                             <view class="label">单价</view>
                             <view class="label">单价</view>
-                            <view class="amount">{{ productData.price | priceFormat }}</view>
+                            <view class="amount">{{ productPrice | priceFormat }}</view>
                         </view>
                         </view>
                         <!-- 券后价 -->
                         <!-- 券后价 -->
                         <view class="row" v-if="productData.couponStatus > 0">
                         <view class="row" v-if="productData.couponStatus > 0">
@@ -33,7 +34,7 @@
                     </view>
                     </view>
                 </view>
                 </view>
                 <view class="tip">
                 <view class="tip">
-                    <template v-if="productData.couponStatus > 1">
+                    <template v-if="productData.couponStatus > 0">
                         当前商品可使用
                         当前商品可使用
                         <text v-text="currentCoupon.couponTitle"></text>
                         <text v-text="currentCoupon.couponTitle"></text>
                         优惠券
                         优惠券
@@ -71,7 +72,16 @@ export default {
         }
         }
     },
     },
     computed: {
     computed: {
-        ...mapGetters(['safeArea'])
+        ...mapGetters(['safeArea']),
+        productPrice() {
+            return this.generatePrice()
+        },
+        limitedNum() {
+            if (this.productData.collageStatus > 0) {
+                return this.productData.collageProduct.limitedNum || this.productData.stock
+            }
+            return this.productData.stock
+        }
     },
     },
     watch: {
     watch: {
         count() {
         count() {
@@ -88,6 +98,21 @@ export default {
             this.$refs.popup.close()
             this.$refs.popup.close()
             this.$emit('close')
             this.$emit('close')
             this.count = 1
             this.count = 1
+        },
+        generatePrice() {
+            // 非阶梯价
+            if (this.productData.activeStatus <= 0) {
+                return this.productData.price
+            }
+            // 阶梯价列表为空
+            if (!this.productData.ladderList) {
+                return this.productData.price
+            }
+            // 阶梯价
+            const lastItem = this.productData.ladderList
+                .sort((a, b) => b.buyNum - a.buyNum)
+                .find(item => this.count >= item.buyNum)
+            return lastItem ? lastItem.buyPrice : this.productData.price
         }
         }
     }
     }
 }
 }

+ 10 - 8
pages/views/goods/config/config.js

@@ -1,23 +1,23 @@
 // 导航栏按钮类别
 // 导航栏按钮类别
 export const navbarButtonGroup = {
 export const navbarButtonGroup = {
-    // 拼团 + 优惠券
-    groupByCoupon: {
-        left: ['领券单独购买', '¥1000.00'],
-        right: ['领券拼团购买', '¥1000.00']
-    },
-
     // 仅拼团
     // 仅拼团
     group: {
     group: {
         left: ['单独购买', '¥1000.00'],
         left: ['单独购买', '¥1000.00'],
         right: ['拼团购买', '¥1000.00']
         right: ['拼团购买', '¥1000.00']
     },
     },
+    
+    // 拼团 + 优惠券
+    groupWithCoupon: {
+        left: ['领券单独购买', '¥1000.00'],
+        right: ['领券拼团购买', '¥1000.00']
+    },
 
 
     // 限时活动 / 活动价 + 优惠券
     // 限时活动 / 活动价 + 优惠券
-    activity: {
+    activityWithCoupon: {
         left: ['加入购物车'],
         left: ['加入购物车'],
         right: ['领券购买', '¥1000.00']
         right: ['领券购买', '¥1000.00']
     },
     },
-
+    
     // 普通方式 不使用优惠券
     // 普通方式 不使用优惠券
     normal: {
     normal: {
         left: ['加入购物车'],
         left: ['加入购物车'],
@@ -30,6 +30,8 @@ export function makeQuery() {
         userId: '',
         userId: '',
         homeFloorId: '',
         homeFloorId: '',
         homeTypeId: '',
         homeTypeId: '',
+        activityId: '',
+        couponId: '',
         listType: 1,
         listType: 1,
         productIds: '',
         productIds: '',
         smallTypeId: '',
         smallTypeId: '',

+ 7 - 28
pages/views/goods/goods-coupon-list.vue

@@ -21,7 +21,7 @@
 </template>
 </template>
 
 
 <script>
 <script>
-import { fetchProductByCoupon } from '@/services/api/coupon.js'
+import { fetchProductList } from '@/services/api/goods.js'
 import { debounce } from '@/common/utils.js'
 import { debounce } from '@/common/utils.js'
 import { mapGetters } from 'vuex'
 import { mapGetters } from 'vuex'
 import { makeQuery } from '@/pages/views/goods/config/config.js'
 import { makeQuery } from '@/pages/views/goods/config/config.js'
@@ -29,13 +29,7 @@ export default {
     data() {
     data() {
         return {
         return {
             isRequest: true,
             isRequest: true,
-            listQuery: {
-                productName: '',
-                userId: '',
-                couponId: '',
-                pageNum: 1,
-                pageSize: 12
-            },
+            listQuery: makeQuery(),
             navInfo: {},
             navInfo: {},
             productList: [],
             productList: [],
             hasNextPage: true,
             hasNextPage: true,
@@ -72,26 +66,11 @@ export default {
             this.filterProductList()
             this.filterProductList()
         },
         },
 
 
-        // 筛选商品
-        onFilter(e) {
-            const { current, sort } = e
-            if (current === 0) {
-                // 综合排序
-                this.listQuery.sortType = 1
-            } else if (current === 1) {
-                // 价格高低
-                this.listQuery.sortType = sort === 'desc' ? 3 : 2
-            } else {
-                // 最新上架
-                this.listQuery.sortType = 4
-            }
-            this.filterProductList()
-        },
-
         // 初始化查询参数
         // 初始化查询参数
         initQueryList(options) {
         initQueryList(options) {
             this.listQuery.userId = this.userId
             this.listQuery.userId = this.userId
             this.listQuery.couponId = options.couponId
             this.listQuery.couponId = options.couponId
+            this.listQuery.listType = 5
             this.fetchProductList()
             this.fetchProductList()
         },
         },
 
 
@@ -112,10 +91,10 @@ export default {
         // 获取商品列表
         // 获取商品列表
         fetchProductList: debounce(async function() {
         fetchProductList: debounce(async function() {
             try {
             try {
-                const resultProductData = await fetchProductByCoupon(this.listQuery)
-                this.productList = [...this.productList, ...resultProductData.data.list]
-                this.hasNextPage = resultProductData.data.hasNextPage
-                this.total = resultProductData.data.total
+                const { data } = await fetchProductList(this.listQuery)
+                this.productList = [...this.productList, ...data.pageInfo.results]
+                this.hasNextPage = data.pageInfo.hasNextPage
+                this.total = data.pageInfo.totalRecord
                 this.listQuery.pageNum++
                 this.listQuery.pageNum++
                 this.isRequest = false
                 this.isRequest = false
                 this.isLoading = false
                 this.isLoading = false

+ 38 - 51
pages/views/goods/goods-detail.vue

@@ -114,6 +114,7 @@ import { debounce } from '@/common/utils.js'
 import { shareDataResult } from '@/common/share.helper.js'
 import { shareDataResult } from '@/common/share.helper.js'
 import { fetchProductDetail } from '@/services/api/goods.js'
 import { fetchProductDetail } from '@/services/api/goods.js'
 import { fetchCouponListByProductId } from '@/services/api/coupon.js'
 import { fetchCouponListByProductId } from '@/services/api/coupon.js'
+import { queryStringify } from '@/common/utils.js'
 import { mapGetters, mapActions } from 'vuex'
 import { mapGetters, mapActions } from 'vuex'
 export default {
 export default {
     data() {
     data() {
@@ -133,7 +134,8 @@ export default {
             couponVisiable: false,
             couponVisiable: false,
             navbarTypeFlag: '',
             navbarTypeFlag: '',
             // 海报数据
             // 海报数据
-            posterData: {}
+            posterData: {},
+            collageId: ''
         }
         }
     },
     },
     computed: {
     computed: {
@@ -180,60 +182,33 @@ export default {
     methods: {
     methods: {
         ...mapActions('cart', ['addToCart']),
         ...mapActions('cart', ['addToCart']),
 
 
-        // 立即购买
-        buyNow(count) {
-            let productStp = {
-                productCount: count,
-                productId: this.productInfo.productId,
-                heUserId: this.productInfo.heUserId,
-                collageFlag: 0,
-                collageId: 0,
-                allCount: count
-            }
-            uni.setStorageSync('COMMIT_PRODUCT_INFO', productStp)
-            this.toCreateOrder()
-        },
-
-        // 拼团购买
-        buyGroupNow(count) {
-            console.log('拼团购买')
-            let productStp = {
-                productCount: count,
-                productId: this.productInfo.productId,
-                heUserId: this.productInfo.heUserId,
-                collageFlag: 1,
-                collageId: 0,
-                allCount: count
-            }
-            uni.setStorageSync('COMMIT_PRODUCT_INFO', productStp)
-            this.toCreateOrder()
-        },
-
-        // 跳转到创建订单
-        toCreateOrder() {
-            this.$router.navigateTo('order/order-create?type=product')
-        },
-
         // 商品提交
         // 商品提交
         onSubmit(count) {
         onSubmit(count) {
-            console.log(count)
+            // 加入购物车
             if (this.navbarTypeFlag === 'cart') {
             if (this.navbarTypeFlag === 'cart') {
                 this.addToCart({
                 this.addToCart({
                     productId: this.productInfo.productId,
                     productId: this.productInfo.productId,
                     productCount: count,
                     productCount: count,
                     heUserId: this.productInfo.heUserId
                     heUserId: this.productInfo.heUserId
                 })
                 })
-                return this.$refs.receiveBuyPopup.close()
             }
             }
 
 
+            // 立即购买(提交商品信息)
             if (this.navbarTypeFlag === 'buy') {
             if (this.navbarTypeFlag === 'buy') {
-                if (this.productInfo.collageStatus > 0) {
-                    this.buyGroupNow(count)
-                } else {
-                    this.buyNow(count)
+                const submitData = {
+                    productId: this.productInfo.productId, // 产品id
+                    productCount: count, // 产品购买数量
+                    heUserId: this.productInfo.heUserId, // 协销用户id
+                    collageFlag: this.productInfo.collageStatus, // 是否是拼团商品
+                    collageId: this.collageId, // 拼团id
+                    couponId: this.productInfo.couponId, // 默认使用优惠券id
+                    allCount: count // 商品总数
                 }
                 }
-                return this.$refs.receiveBuyPopup.close()
+                uni.setStorageSync('COMMIT_PRODUCT_INFO', submitData)
+                this.$router.navigateTo('order/order-create?type=product')
             }
             }
+
+            this.$refs.receiveBuyPopup.close()
         },
         },
 
 
         // 优惠券点击事件
         // 优惠券点击事件
@@ -250,11 +225,18 @@ export default {
 
 
         // 分享事件
         // 分享事件
         onShare() {
         onShare() {
+            const query = queryStringify({
+                type: 1,
+                productId: this.productInfo.productId,
+                inviteUserId: this.userId,
+                jumpState: this.jumpState
+            })
             this.posterData = {
             this.posterData = {
-                porductName: '肌本演绎360愉悦修护套组标准版防晒修复补水',
-                productPrice: 500,
-                productOriginPrice: 800,
-                productImage: 'https://picsum.photos/1000/1000?random=1'
+                porductName: this.productInfo.name,
+                productPrice: this.productInfo.price,
+                productOriginPrice: this.productInfo.normalPrice,
+                productImage: 'https://picsum.photos/1000/1000?random=1',
+                query: query
             }
             }
             this.$refs.sharePopup.open()
             this.$refs.sharePopup.open()
         },
         },
@@ -276,11 +258,16 @@ export default {
         // 初始化导航按钮文案
         // 初始化导航按钮文案
         initNavbarButton() {
         initNavbarButton() {
             const navbarButton = navbarButtonGroup[this.navbarType]
             const navbarButton = navbarButtonGroup[this.navbarType]
-            // 拼团商品 + 其他商品
-            if (this.navbarType === 'groupByCoupon') {
+            if (this.navbarType === 'groupWithCoupon') {
                 navbarButton.left[1] = `¥${this.productInfo.normalCouponPrice.toFixed(2)}`
                 navbarButton.left[1] = `¥${this.productInfo.normalCouponPrice.toFixed(2)}`
-            } else {
                 navbarButton.right[1] = `¥${this.productInfo.couponPrice.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 {
+                navbarButton.right[1] = ''
             }
             }
             this.leftButton = navbarButton.left
             this.leftButton = navbarButton.left
             this.rightButton = navbarButton.right
             this.rightButton = navbarButton.right
@@ -357,11 +344,11 @@ export default {
             const { couponStatus = 0, collageStatus = 0, activeStatus = 0, discountStatus = 0 } = this.productInfo
             const { couponStatus = 0, collageStatus = 0, activeStatus = 0, discountStatus = 0 } = this.productInfo
             if ((activeStatus > 0 || discountStatus > 0) && couponStatus > 0) {
             if ((activeStatus > 0 || discountStatus > 0) && couponStatus > 0) {
                 // (限时活动 / 活动价) + 优惠券
                 // (限时活动 / 活动价) + 优惠券
-                return 'activity'
+                return 'activityWithCoupon'
             } else if (collageStatus > 0) {
             } else if (collageStatus > 0) {
                 if (couponStatus > 0) {
                 if (couponStatus > 0) {
                     // 拼团 + 优惠券
                     // 拼团 + 优惠券
-                    return 'groupByCoupon'
+                    return 'groupWithCoupon'
                 } else {
                 } else {
                     // 仅拼团
                     // 仅拼团
                     return 'group'
                     return 'group'

+ 10 - 5
pages/views/goods/goods-list.vue

@@ -9,7 +9,7 @@
         </view>
         </view>
         <!-- 商品列表 -->
         <!-- 商品列表 -->
         <view class="product-list">
         <view class="product-list">
-            <view class="product-item" v-for="(product, index) in productList" :key="product.productId">
+            <view class="product-item" v-for="(product, index) in productList" :key="index">
                 <cm-product :data="product"></cm-product>
                 <cm-product :data="product"></cm-product>
             </view>
             </view>
         </view>
         </view>
@@ -120,10 +120,15 @@ export default {
         // 获取商品列表
         // 获取商品列表
         fetchProductList: debounce(async function() {
         fetchProductList: debounce(async function() {
             try {
             try {
-                const resultProductData = await fetchProductList(this.listQuery)
-                this.productList = [...this.productList, ...resultProductData.data.results]
-                this.hasNextPage = resultProductData.data.hasNextPage
-                this.total = resultProductData.data.totalRecord
+                if (this.listQuery.sortType === 1) {
+                    this.listQuery.productIds = this.productList.map(item => item.productId).join(',')
+                } else {
+                    this.listQuery.productIds = ''
+                }
+                const { data } = await fetchProductList(this.listQuery)
+                this.productList = [...this.productList, ...data.pageInfo.results]
+                this.hasNextPage = data.pageInfo.hasNextPage
+                this.total = data.pageInfo.totalRecord
                 this.listQuery.pageNum++
                 this.listQuery.pageNum++
                 this.isRequest = false
                 this.isRequest = false
                 this.isLoading = false
                 this.isLoading = false

+ 27 - 25
pages/views/order/components/order-product/order-product.vue

@@ -1,25 +1,24 @@
 <template>
 <template>
     <view class="order-product">
     <view class="order-product">
-        <image class="cover" :src="productData.image" mode="widthFix"></image>
+        <image class="cover" :src="productInfo.productImage" mode="widthFix"></image>
         <view class="content">
         <view class="content">
-            <view class="name" v-text="productData.name"></view> <view class="unit">规格:{{ productData.unit }}</view>
+            <view class="name" v-text="productInfo.name"></view>
+            <view class="unit">规格:{{ productInfo.productUnit }}</view>
             <view class="tags">
             <view class="tags">
-                <template v-if="tagsList.length > 0">
-                    <view class="tag other" v-for="(tag, index) in tagsList" :key="index">{{ tag }}</view>
-                </template>
-                <view class="tag pt" v-if="productInfo.collagePriceFlag === 1 || productInfo.collageStatus === 1">
-                    拼团价
-                </view>
-                <template v-if="productInfo.activeStatus">
-                    <view class="tag cx" v-if="userId === productInfo.heUserId">促销</view>
-                    <view class="tag cx" v-else>自营</view>
-                    <view class="tag hd" v-if="productInfo.ladderList.length > 0">活动价</view>
-                </template>
+                <!-- 促销 自营 -->
+                <view class="tag cx" v-if="userId === productInfo.heUserId">促销</view>
+                <view class="tag cx" v-else>自营</view>
+                <!-- 拼团价  活动价  限时特价  券后价   -->
+                <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>
             </view>
-            <view class="price">¥{{ productData.price | priceFormat }}</view>
-            <view class="buy-num" v-if="numType === 1">×{{ productData.count }}</view>
+            <view class="price">¥{{ productInfo.price | priceFormat }}</view>
+            <view class="buy-num" v-if="numType === 1">×{{ productInfo.num }}</view>
             <view class="buy-num" v-if="numType === 2">
             <view class="buy-num" v-if="numType === 2">
-                <cm-number-box v-model="productData.count" @change="onCountChange"></cm-number-box>
+                <cm-number-box v-model="productInfo.num" @change="onCountChange"></cm-number-box>
             </view>
             </view>
         </view>
         </view>
     </view>
     </view>
@@ -43,17 +42,20 @@ export default {
         }
         }
     },
     },
     computed: {
     computed: {
-        productData() {
-            return {
-                image: this.productInfo.mainImage || this.productInfo.productImage,
-                name: this.productInfo.productName || this.productInfo.name,
-                unit: this.productInfo.unit || this.productInfo.productUnit,
-                price: this.productInfo.price,
-                count: this.productInfo.productCount || this.productInfo.num
-            }
-        },
         userId() {
         userId() {
             return this.$store.getters.userId
             return this.$store.getters.userId
+        },
+        // 活动价
+        isActivityPrice() {
+            return this.productInfo.activeStatus > 0 || this.productInfo.actProduct === '1'
+        },
+        // 拼团价
+        isCollagePrice() {
+            return this.productInfo.collageStatus > 0 || this.productInfo.actProduct === '2'
+        },
+        // 限时特价
+        isDiscountPrice() {
+            return this.productInfo.discountStatus > 0 || this.productInfo.actProduct === '3'
         }
         }
     },
     },
     methods: {
     methods: {

+ 40 - 41
pages/views/order/mixins/orderList.js

@@ -4,7 +4,7 @@ import { shoppingAddCartFromOrder } from '@/services/api/cart.js'
 const orderList = {
 const orderList = {
     data() {
     data() {
         return {
         return {
-            hanldOrder: {}, // 当前要处理的订单信息
+            hanldOrder: {}, // 当前要处理的订单操作
             modal: false,
             modal: false,
             modalText: '',
             modalText: '',
             buyAgainModal: false,
             buyAgainModal: false,
@@ -17,43 +17,42 @@ const orderList = {
         handleConfirmClick(e) {
         handleConfirmClick(e) {
             const { type, order } = (this.hanldOrder = e)
             const { type, order } = (this.hanldOrder = e)
             switch (type) {
             switch (type) {
-            // 其他操作
-            case 'again':
-                console.log('再次购买')
-                this.buyAgain()
-                break
-            case 'share':
-                console.log('分享订单')
-                this.handleShare()
-                break
-            case 'query':
-                console.log('订单详情')
-                this.$router.navigateTo('order/order-detail?orderId=' + order.orderId)
-                break
-            case 'fightDetail':
-                this.$router.navigateTo('share-buy/share-buy-detail?collageId=' + order.collageId)
-                break
-            case 'fightShare':
-                console.log('分享邀请好友拼团')
-                this.$router.navigateTo('share-buy/share-buy-detail?collageId=' + order.collageId)
-                break
-                // 常规操作
-            case 'cancel':
-                this.modal = true
-                this.modalText = '确认取消该订单吗?'
-                break
-            case 'delete':
-                this.modal = true
-                this.modalText = '确认删除该订单吗?'
-                break
-            case 'confirm':
-                this.modal = true
-                this.modalText = '是否确认收货?'
-                break
-            case 'pay':
-                this.modal = true
-                this.modalText = '确认支付?'
-                break
+                // 其他操作
+                case 'again':
+                    console.log('再次购买')
+                    this.buyAgain()
+                    break
+                case 'share':
+                    console.log('分享订单')
+                    this.handleShare()
+                    break
+                case 'query':
+                    console.log('订单详情')
+                    this.$router.navigateTo('order/order-detail?orderId=' + order.orderId)
+                    break
+                case 'fightDetail':
+                    this.$router.navigateTo('share-buy/share-buy-detail?collageId=' + order.collageId)
+                    break
+                case 'fightShare':
+                    console.log('分享邀请好友拼团')
+                    this.$router.navigateTo('share-buy/share-buy-detail?collageId=' + order.collageId)
+                    break
+                    // 常规操作
+                case 'cancel':
+                    this.modal = true
+                    this.modalText = '确认取消该订单吗?'
+                    break
+                case 'delete':
+                    this.modal = true
+                    this.modalText = '确认删除该订单吗?'
+                    break
+                case 'confirm':
+                    this.modal = true
+                    this.modalText = '是否确认收货?'
+                    break
+                case 'pay':
+                    this.$router.navigateTo('order/order-pay?orderId=' + order.orderId)
+                    break
             }
             }
         },
         },
         // 确认收货
         // 确认收货
@@ -160,9 +159,9 @@ const orderList = {
                 11: '待付款待发货',
                 11: '待付款待发货',
                 12: '待付款部分发货',
                 12: '待付款部分发货',
                 13: '待付款已发货',
                 13: '待付款已发货',
-                // 21: '部分付款待发货',
-                // 22: '部分付款部分发货',
-                // 23: '部分付款已发货',
+                21: '部分付款待发货',
+                22: '部分付款部分发货',
+                23: '部分付款已发货',
                 31: '已付款待发货',
                 31: '已付款待发货',
                 32: '已付款部分发货',
                 32: '已付款部分发货',
                 33: '已付款已发货',
                 33: '已付款已发货',

+ 2 - 3
pages/views/order/mixins/orderShare.js

@@ -33,11 +33,10 @@ const orderShare = {
         }
         }
         console.log(shareData)
         console.log(shareData)
         // 加密参数
         // 加密参数
-        const state_str = encodeURIComponent(this.$crypto.encrypt(shareData))
+        const scenencodeURIComponent(this.$crypto.encrypt(shareData))
         return {
         return {
             title: resultMessage.title,
             title: resultMessage.title,
-            path: `/pages/tabBar/index/index?state_str=${state_str}`,
-            imageUrl: resultMessage.imageUrl
+            path: `/pages/tabBar/index/index?scenecenscene        imageUrl: resultMessage.imageUrl
         }
         }
     }
     }
 }
 }

+ 5 - 3
pages/views/order/mixins/wechatPay.js

@@ -44,13 +44,15 @@ const wechatPay = {
                 const wechatCode = await wxLogin()
                 const wechatCode = await wxLogin()
                 // 微信支付请求 返回支付信息
                 // 微信支付请求 返回支付信息
                 const response = await wechatMiniWxPay({
                 const response = await wechatMiniWxPay({
-                    payAmount: data.payableAmount * 100,
+                    payAmount: data.payableAmount,
                     payWay: 'WEIXIN',
                     payWay: 'WEIXIN',
+                    payType: 'XCX',
                     code: wechatCode,
                     code: wechatCode,
-                    orderId: data.orderId
+                    orderId: data.orderId,
+                    shopOrderId: data.shopOrderId
                 })
                 })
                 // 处理支付信息 调用微信支付
                 // 处理支付信息 调用微信支付
-                const payment = JSON.parse(response.data.data.payInfo)
+                const payment = JSON.parse(response.data.rt10_payInfo)
                 const payFlag = await wxRequestPayment(payment)
                 const payFlag = await wxRequestPayment(payment)
                 if (payFlag) {
                 if (payFlag) {
                     // 微信支付成功回调 在页面onload中通过this.$on监听orderPaySuccess事件回调
                     // 微信支付成功回调 在页面onload中通过this.$on监听orderPaySuccess事件回调

+ 100 - 34
pages/views/order/order-create.vue

@@ -2,7 +2,9 @@
     <view class="order-create">
     <view class="order-create">
         <tui-skeleton v-if="isRequest" :loadingType="3" :isLoading="true"></tui-skeleton>
         <tui-skeleton v-if="isRequest" :loadingType="3" :isLoading="true"></tui-skeleton>
         <!-- 地址选择 -->
         <!-- 地址选择 -->
-        <order-choose-address class="sticky-top" :addressInfo="addressInfo"></order-choose-address>
+        <view class="sticky-top">
+            <order-choose-address class="sticky-top" :addressInfo="addressInfo"></order-choose-address>
+        </view>
         <!-- 供应商商品列表 -->
         <!-- 供应商商品列表 -->
         <view class="shop-list">
         <view class="shop-list">
             <view class="section" v-for="(shopInfo, index) in shopList" :key="shopInfo.shopId">
             <view class="section" v-for="(shopInfo, index) in shopList" :key="shopInfo.shopId">
@@ -19,25 +21,34 @@
             </view>
             </view>
         </view>
         </view>
         <!-- 优惠券 -->
         <!-- 优惠券 -->
-        <view class="cell-section" @click="couponVisiable = true">
+        <view class="cell-section" @click="couponVisiable = true" v-if="receiveCouponList.length > 0">
             <tui-list-cell :arrow="true" :padding="cellPadding" :unlined="true">
             <tui-list-cell :arrow="true" :padding="cellPadding" :unlined="true">
                 <view class="cell-content">
                 <view class="cell-content">
-                    <text>优惠券</text> <text class="reduce tip">-¥{{ couponAmount | priceFormat }}</text>
+                    <text class="label">优惠券</text>
+                    <text class="reduce tip">-¥{{ couponAmount | priceFormat }}</text>
                 </view>
                 </view>
             </tui-list-cell>
             </tui-list-cell>
         </view>
         </view>
         <!-- 分享减免 -->
         <!-- 分享减免 -->
-        <view class="cell-section" @click="$refs.sharePopup.open()">
+        <view class="cell-section" @click="onShare" v-if="reduction">
             <tui-list-cell :arrow="false" :padding="cellPadding" :unlined="true">
             <tui-list-cell :arrow="false" :padding="cellPadding" :unlined="true">
                 <button class="cell-content share-btn">
                 <button class="cell-content share-btn">
-                    <text>金额满99元,分享可立减20元</text> <text class="reduce tip">点击分享</text>
+                    <text v-if="!shareStatus" class="active label">
+                        金额满¥{{ reduction.touchPrice }}元,分享可立减¥{{ reduction.reducedAmount }}元
+                    </text>
+                    <text class="label" v-else>分享减免</text>
+                    <text class="reduce tip" v-if="!shareStatus">点击分享</text>
+                    <text class="active" v-else>-¥{{ reduction.reducedAmount | priceFormat }}</text>
                 </button>
                 </button>
             </tui-list-cell>
             </tui-list-cell>
         </view>
         </view>
         <!-- 运费 -->
         <!-- 运费 -->
         <view class="cell-section">
         <view class="cell-section">
             <tui-list-cell :arrow="false" :padding="cellPadding" :unlined="true">
             <tui-list-cell :arrow="false" :padding="cellPadding" :unlined="true">
-                <view class="cell-content"> <text>运费</text> <text class="tip postage">免邮</text> </view>
+                <view class="cell-content">
+                    <text class="label">运费</text>
+                    <text class="tip postage">免邮</text>
+                </view>
             </tui-list-cell>
             </tui-list-cell>
         </view>
         </view>
         <!-- 提交订单 -->
         <!-- 提交订单 -->
@@ -56,14 +67,19 @@
             @checkedNone="onCheckedNone"
             @checkedNone="onCheckedNone"
         ></cm-coupon-popup>
         ></cm-coupon-popup>
         <!-- 分享 -->
         <!-- 分享 -->
-        <cm-share-popup ref="sharePopup"></cm-share-popup>
+        <cm-share-popup ref="sharePopup" :data="posterData" type="normal" @close="onAfterShare"></cm-share-popup>
+        <!-- 订单提交拦截 -->
+        <tui-modal :show="preventModal" :content="preventText" @click="onPreventModalConfirm"></tui-modal>
+        <!-- 安全区域 -->
+        <cm-safe-area-bottom></cm-safe-area-bottom>
     </view>
     </view>
 </template>
 </template>
 
 
 <script>
 <script>
-import { orderConfirm, orderSubmit } from '@/services/api/order.js'
+import { orderConfirm, orderSubmit, orderReductionShare } from '@/services/api/order.js'
 import { fetchAddressList } from '@/services/api/user.js'
 import { fetchAddressList } from '@/services/api/user.js'
 import { initFormatCouponList, splitCouponList, chooseBestCoupon } from '@/common/business.helper.js'
 import { initFormatCouponList, splitCouponList, chooseBestCoupon } from '@/common/business.helper.js'
+import { queryStringify } from '@/common/utils.js'
 import { mapGetters } from 'vuex'
 import { mapGetters } from 'vuex'
 import wechatPayMixins from '@/pages/views/order/mixins/wechatPay.js'
 import wechatPayMixins from '@/pages/views/order/mixins/wechatPay.js'
 export default {
 export default {
@@ -79,7 +95,8 @@ export default {
                 productId: '',
                 productId: '',
                 productCount: '',
                 productCount: '',
                 heUserId: '',
                 heUserId: '',
-                collageFlag: 0
+                collageFlag: 0,
+                couponId: ''
             },
             },
 
 
             // 订单提交参数
             // 订单提交参数
@@ -117,13 +134,18 @@ export default {
             shareReductStatus: false,
             shareReductStatus: false,
             reduction: null,
             reduction: null,
             reductionUserId: 0, //分享抵扣用户id
             reductionUserId: 0, //分享抵扣用户id
-            shareData: {
-                type: 0
-            },
 
 
             allCount: 0, // 全部商品数量
             allCount: 0, // 全部商品数量
             // 统计价格(接口返回)
             // 统计价格(接口返回)
-            totalPrice: 0
+            totalPrice: 0,
+
+            preventModal: false,
+            preventText: '',
+
+            // 分享数据
+            posterData: {},
+
+            shareStatus: false
         }
         }
     },
     },
     computed: {
     computed: {
@@ -139,9 +161,13 @@ export default {
                 return 0
                 return 0
             }
             }
         },
         },
+        // 分享减免金额
+        shareReducedAmount() {
+            return this.reduction && this.shareStatus ? this.reduction.reducedAmount : 0
+        },
         // 减免金额
         // 减免金额
         discountedPrice() {
         discountedPrice() {
-            return this.couponAmount
+            return this.couponAmount + this.shareReducedAmount
         },
         },
         // 支付金额
         // 支付金额
         payAllPrice() {
         payAllPrice() {
@@ -161,7 +187,6 @@ export default {
     },
     },
     onLoad(options) {
     onLoad(options) {
         this.initOptions(options)
         this.initOptions(options)
-        this.orderPaySuccess() // 支付回调
     },
     },
     onShow() {
     onShow() {
         this.resetAddress()
         this.resetAddress()
@@ -171,17 +196,34 @@ export default {
         uni.removeStorageSync('COMMIT_PRODUCT_INFO')
         uni.removeStorageSync('COMMIT_PRODUCT_INFO')
         uni.removeStorageSync('CHOOSE_ADDRESS')
         uni.removeStorageSync('CHOOSE_ADDRESS')
     },
     },
+    onShareAppMessage() {
+        // 加密
+        const state_str = encodeURIComponent(this.$crypto.encrypt({ type: 0 }))
+        return {
+            title: '护肤上颜选,正品有好货~',
+            path: `/pages/index/index?state_str=${state_str}`,
+            imageUrl: this.staticUrl + 'icon-share.png'
+        }
+    },
     methods: {
     methods: {
-        // 支付成功回调
-        orderPaySuccess() {
-            this.$on('orderPaySuccess', orderInfo => {
-                if (this.collageFlag === 1) {
-                    uni.redirectTo({ url: `share-buy/share-buy-detail?collageId=${this.collageId}` })
-                } else {
-                    uni.setStorageSync('PAY_ORDER_INFO', orderInfo)
-                    this.$router.redirectTo('order/pay-success')
-                }
-            })
+        // 分享事件
+        onShare() {
+            this.posterData = { query: queryStringify({ type: 0 }) }
+            this.$refs.sharePopup.open()
+        },
+
+        // 分享结束
+        async onAfterShare() {
+            try {
+                if (!this.reduction) return
+                const { reductionId } = this.reduction
+                const res = await orderReductionShare({ reductionId, shareType: 1, userId: this.userId })
+                this.reductionUserId = res.data
+                this.$toast('以为您减免金额')
+                this.shareStatus = true
+            } catch (e) {
+                this.$toast('分享失败')
+            }
         },
         },
 
 
         // 商品数量变化
         // 商品数量变化
@@ -189,27 +231,28 @@ export default {
             this.confirmParams.productCount = value
             this.confirmParams.productCount = value
             this.initOrderInfo()
             this.initOrderInfo()
         },
         },
+
         // 初始化参数信息
         // 初始化参数信息
         initOptions(options) {
         initOptions(options) {
             this.submitType = options.type
             this.submitType = options.type
             this.confirmParams.userId = this.userId
             this.confirmParams.userId = this.userId
             if (this.submitType === 'product' || this.submitType === 'shareBuy') {
             if (this.submitType === 'product' || this.submitType === 'shareBuy') {
                 const productInfo = uni.getStorageSync('COMMIT_PRODUCT_INFO')
                 const productInfo = uni.getStorageSync('COMMIT_PRODUCT_INFO')
-                this.submitParams.cartType = 2 // 从商品详情 / 拼单入口提交
+                this.submitParams.cartType = 2 // 从商品详情 / 拼单入口提交(标识)
                 this.confirmParams.productCount = productInfo.productCount
                 this.confirmParams.productCount = productInfo.productCount
                 this.confirmParams.productId = productInfo.productId
                 this.confirmParams.productId = productInfo.productId
                 this.confirmParams.heUserId = productInfo.heUserId || 0
                 this.confirmParams.heUserId = productInfo.heUserId || 0
-                this.confirmParams.collageFlag = this.collageFlag = productInfo.collageFlag
-                this.collageId = parseInt(productInfo.collageId) || 0
+                this.confirmParams.collageFlag = this.collageFlag = productInfo.collageFlag // 是否是拼团商品
+                this.confirmParams.couponId = productInfo.couponId
+                this.collageId = parseInt(productInfo.collageId) || 0 // 拼团id
                 this.allCount = productInfo.allCount
                 this.allCount = productInfo.allCount
             } else {
             } else {
                 const cartInfo = uni.getStorageSync('COMMIT_CART_INFO')
                 const cartInfo = uni.getStorageSync('COMMIT_CART_INFO')
-                this.submitParams.cartType = 1 // 从购物车提交
+                this.submitParams.cartType = 1 // 从购物车提交(标识)
                 this.confirmParams.cartIds = cartInfo.cartIds.join()
                 this.confirmParams.cartIds = cartInfo.cartIds.join()
                 this.allCount = cartInfo.allCount
                 this.allCount = cartInfo.allCount
             }
             }
             this.initOrderInfo()
             this.initOrderInfo()
-            // this.getUserAddress()
         },
         },
 
 
         // 提交订单
         // 提交订单
@@ -222,6 +265,8 @@ export default {
                 this.$toast('请先添加收货地址~')
                 this.$toast('请先添加收货地址~')
                 return
                 return
             }
             }
+
+            //设置收货地址
             this.submitParams.addressId = this.addressInfo.addressId
             this.submitParams.addressId = this.addressInfo.addressId
 
 
             // 优惠券,分享活动相关参数
             // 优惠券,分享活动相关参数
@@ -234,10 +279,10 @@ export default {
             this.submitParams.orderInfo = this.shopList.map(shop => {
             this.submitParams.orderInfo = this.shopList.map(shop => {
                 const productInfo = shop.productList.map(product => ({
                 const productInfo = shop.productList.map(product => ({
                     productId: product.productId,
                     productId: product.productId,
-                    productNum: product.productCount,
+                    productNum: product.num,
                     heUserId: product.heUserId
                     heUserId: product.heUserId
                 }))
                 }))
-                return { shopId: shop.shopId, note: shop.note, productInfo }
+                return { shopId: shop.shopId, note: shop.note, productInfo, splitCode: shop.splitCode }
             })
             })
 
 
             // 提交订单
             // 提交订单
@@ -250,13 +295,22 @@ export default {
                     uni.setStorageSync('PAY_ORDER_INFO', res.data)
                     uni.setStorageSync('PAY_ORDER_INFO', res.data)
                     this.$router.redirectTo('order/pay-success')
                     this.$router.redirectTo('order/pay-success')
                 } else {
                 } else {
-                    this.miniWxPayFor(res.data)
+                    // 子订单支付
+                    this.$router.redirectTo(`order/order-pay?orderId=${res.data.orderId}`)
                 }
                 }
             } catch (e) {
             } catch (e) {
                 console.log(e)
                 console.log(e)
+                this.preventModal = true
+                this.preventText = e.msg
             }
             }
         },
         },
 
 
+        // 订单提交拦截确认
+        onPreventModalConfirm() {
+            this.preventModal = false
+            uni.navigateBack({ delta: 1 })
+        },
+
         // 优惠券,分享活动相关参数
         // 优惠券,分享活动相关参数
         getDiscountInfo() {
         getDiscountInfo() {
             return {
             return {
@@ -310,8 +364,12 @@ export default {
             try {
             try {
                 const res = await orderConfirm(this.confirmParams)
                 const res = await orderConfirm(this.confirmParams)
                 this.totalPrice = res.data.totalPrice
                 this.totalPrice = res.data.totalPrice
+                this.reduction = res.data.reduction
                 this.shopList = this.bindNoteMessage(res.data.shopList)
                 this.shopList = this.bindNoteMessage(res.data.shopList)
-                this.initCouponList(res.data.receiveCouponList)
+                // 只有存在优惠券时才执行后续操作(阻止不必要的计算统计)
+                if (res.data.receiveCouponList.length > 0) {
+                    this.initCouponList(res.data.receiveCouponList)
+                }
             } catch (e) {
             } catch (e) {
                 console.log(e)
                 console.log(e)
             } finally {
             } finally {
@@ -453,6 +511,10 @@ export default {
                 margin-right: 0;
                 margin-right: 0;
             }
             }
 
 
+            .label {
+                font-weight: bold;
+            }
+
             &.share-btn {
             &.share-btn {
                 padding: 0;
                 padding: 0;
                 margin: 0;
                 margin: 0;
@@ -460,6 +522,10 @@ export default {
                 font-size: 26rpx;
                 font-size: 26rpx;
                 line-height: inherit;
                 line-height: inherit;
 
 
+                .active {
+                    color: #f83c6c;
+                }
+
                 .tip {
                 .tip {
                     margin-right: 0;
                     margin-right: 0;
                 }
                 }

+ 307 - 0
pages/views/order/order-pay.vue

@@ -0,0 +1,307 @@
+<template>
+    <view class="order-pay">
+        <view class="top-tip">请对每家店铺分别进行付款</view>
+        <template v-for="order in orderList">
+            <view class="shop-info" :key="order.shopId">
+                <view class="shop-name">{{ order.shopName }}</view>
+                <view class="product-list">
+                    <template v-for="product in order.orderProductList">
+                        <view class="product" :key="product.orderProductId">
+                            <image class="cover" :src="product.productImage" mode="widthFix"></image>
+                            <view class="content">
+                                <view class="count">×{{ product.num }}</view>
+                                <view class="title">{{ product.name }}</view>
+                                <view class="unit">规格:{{ product.productUnit }}</view>
+                                <view class="tags">
+                                    <template v-if="product.activeStatus">
+                                        <view class="tag type1" v-if="userId === product.heUserId">促销</view>
+                                        <view class="tag type1" v-else>自营</view>
+                                        <view
+                                            class="tag type2"
+                                            v-if="product.ladderList && product.ladderList.length > 0"
+                                        >
+                                            活动价
+                                        </view>
+                                    </template>
+                                </view>
+                                <view class="price">
+                                    <text class="active">¥{{ product.price | priceFormat }}</text>
+                                    <text class="deleted">¥{{ product.normalPrice | priceFormat }}</text>
+                                </view>
+                            </view>
+                        </view>
+                    </template>
+                </view>
+                <view class="total">
+                    <text v-if="order.eachDiscount">优惠:¥{{ order.eachDiscount }}</text>
+                    <text v-if="order.receiptAmount">已付:¥{{ order.receiptAmount }}</text>
+                </view>
+                <view class="foot" v-if="order.receiptStatus !== 3">
+                    <view class="price">
+                        <text>待付:</text>
+                        <text class="active">¥{{ order.restAmount | priceFormat }}</text>
+                    </view>
+                    <view class="submit" @click="onPayOrder(order)">付款</view>
+                </view>
+            </view>
+        </template>
+
+        <view class="shop-info">
+            <view class="shop-name">采美快递物流商</view>
+            <view class="product-list">
+                <view class="product">
+                    <image
+                        class="cover"
+                        src="https://static.caimei365.com/app/mini-hehe/icon/icon-logistics.png"
+                        mode="widthFix"
+                    ></image>
+                    <view class="content between">
+                        <view class="title">运费</view>
+                        <view class="price"><text>¥0</text></view>
+                        <view class="count">×1</view>
+                    </view>
+                </view>
+            </view>
+            <!-- <view class="total">
+				<text>优惠:¥20.00</text>
+				<text>已付:¥0</text>
+			</view> -->
+            <view class="foot">
+                <view class="price">
+                    <text>待付:</text>
+                    <text class="active">¥0</text>
+                </view>
+                <!-- <view class="submit" @click="onPay">付款</view> -->
+            </view>
+        </view>
+
+        <!-- 操作弹窗 -->
+        <tui-modal :show="modal" content="确认支付?" :maskClosable="false" @click="handleModalConfirm"></tui-modal>
+    </view>
+</template>
+
+<script>
+import { mapGetters } from 'vuex'
+import wechatPay from './mixins/wechatPay.js'
+import { fetchOrderDetail } from '@/services/api/order.js'
+export default {
+    mixins: [wechatPay],
+    data() {
+        return {
+            orderId: '',
+            modal: false,
+            orderList: [],
+            orderInfo: {}
+        }
+    },
+    computed: {
+        ...mapGetters(['userId'])
+    },
+    onLoad(option) {
+        this.orderId = option.orderId
+        this.getOrderDetail() // 获取订单支付列表
+        this.orderPaySuccess() // 支付回调执行函数
+    },
+    methods: {
+        // 支付成功回调
+        orderPaySuccess() {
+            this.$on('orderPaySuccess', orderInfo => {
+                if (this.collageFlag === 1) {
+                    uni.redirectTo({ url: `share-buy/share-buy-detail?collageId=${this.collageId}` })
+                } else {
+                    uni.setStorageSync('PAY_ORDER_INFO', orderInfo)
+                    this.$router.redirectTo('order/pay-success')
+                }
+            })
+        },
+        // 确认支付
+        handleModalConfirm(e) {
+            this.modal = false
+            if (!e.index) return
+            this.miniWxPayFor(this.orderInfo)
+        },
+        // 子订单支付
+        onPayOrder(orderInfo) {
+            orderInfo.payableAmount = orderInfo.restAmount
+            this.orderInfo = orderInfo
+            this.modal = true
+        },
+        // 获取订单支付列表
+        async getOrderDetail() {
+            try {
+                const { data } = await fetchOrderDetail({ orderId: this.orderId })
+                this.orderList = data.shopOrderList
+            } catch (e) {
+                console.log('获取订单信息失败')
+                console.log(e)
+            }
+        }
+    }
+}
+</script>
+
+<style lang="scss" scoped>
+.order-pay {
+    min-height: 100vh;
+    background: #f7f7f7;
+    .top-tip {
+        position: sticky;
+        top: 0;
+        z-index: 99;
+        width: 750rpx;
+        height: 80rpx;
+        line-height: 80rpx;
+        padding: 0 24rpx;
+        background: #fff3f7;
+        color: #ff457b;
+        font-size: 26rpx;
+        box-sizing: border-box;
+    }
+
+    .shop-info {
+        padding: 32rpx 24rpx;
+        background-color: #fff;
+        margin-bottom: 20rpx;
+        .shop-name {
+            font-size: 30rpx;
+            color: #333333;
+            font-weight: bold;
+        }
+        .product-list {
+            .product {
+                display: flex;
+                margin: 20rpx 0;
+                .cover {
+                    width: 180rpx;
+                    height: 180rpx;
+                    border-radius: 8rpx;
+                    background-color: #f7f7f7;
+                }
+                .content {
+                    position: relative;
+                    width: 500rpx;
+                    margin-left: 16rpx;
+
+                    .count {
+                        position: absolute;
+                        bottom: 0;
+                        right: 0;
+                        font-size: 26rpx;
+                        color: #666;
+                    }
+
+                    &.between {
+                        display: flex;
+                        flex-direction: column;
+                        justify-content: space-between;
+                    }
+
+                    .title {
+                        font-size: 28rpx;
+                        color: #333333;
+                        text-align: justify;
+                        height: 72rpx;
+                        line-height: 36rpx;
+                    }
+                    .unit {
+                        font-size: 20rpx;
+                        color: #999999;
+                        margin: 8rpx 0;
+                    }
+                    .tags {
+                        display: flex;
+                        justify-content: flex-start;
+                        align-items: center;
+                        width: 100%;
+                        height: 30rpx;
+                        .tag {
+                            margin-right: 8rpx;
+                            font-size: 22rpx;
+                            height: 30rpx;
+                            line-height: 30rpx;
+                            text-align: center;
+
+                            &.type1 {
+                                padding: 0 8rpx;
+                                background: #f83c6c;
+                                border-radius: 4rpx;
+                                color: #fff;
+                            }
+
+                            &.type2 {
+                                width: 80rpx;
+                                color: #f83c6c;
+                                background: url(https://static.caimei365.com/app/mini-hehe/icon/icon-active.png) top
+                                    center no-repeat;
+                                background-size: contain;
+                            }
+                            &.type3 {
+                                width: 80rpx;
+                                background: linear-gradient(270deg, #ff457b 0%, #b03bb8 51%, #6431f2 100%);
+                                color: #fff;
+                                border-radius: 4rpx;
+                            }
+                            &.type4 {
+                                border: 1rpx solid #f83c6c;
+                                padding: 0 6rpx;
+                                color: #f83c6c;
+                                border-radius: 4rpx;
+                            }
+                        }
+                    }
+                }
+                .price {
+                    font-size: 26rpx;
+                    .active {
+                        color: #ff457b;
+                    }
+
+                    .deleted {
+                        margin-left: 24rpx;
+                        font-size: 24rpx;
+                        color: #999;
+                        text-decoration: line-through;
+                    }
+                }
+            }
+        }
+        .total {
+            padding-left: 220rpx - 24rpx;
+            margin: 16rpx 0 20rpx;
+            font-size: 26rpx;
+            color: #333;
+
+            text {
+                &:nth-child(2) {
+                    margin-left: 56rpx;
+                }
+            }
+        }
+        .foot {
+            display: flex;
+            justify-content: flex-end;
+            align-items: center;
+            .price {
+                font-size: 26rpx;
+                color: #333333;
+
+                .active {
+                    color: #ff457b;
+                }
+            }
+            .submit {
+                display: flex;
+                justify-content: center;
+                align-items: center;
+                width: 160rpx;
+                height: 64rpx;
+                margin-left: 40rpx;
+                background: linear-gradient(90deg, #fa55bf 0%, #f83c6c 100%);
+                color: #ffffff;
+                border-radius: 32rpx;
+                font-size: 26rpx;
+            }
+        }
+    }
+}
+</style>

+ 85 - 10
pages/views/order/pay-success.vue

@@ -12,9 +12,20 @@
         </view>
         </view>
         <!-- 执行操作 -->
         <!-- 执行操作 -->
         <view class="control">
         <view class="control">
-            <tui-button type="base" width="600rpx" height="90rpx" shape="circle" :size="28" @click="toBuy">
+            <tui-button
+                type="base"
+                width="600rpx"
+                height="90rpx"
+                shape="circle"
+                :size="28"
+                @click="toBuy"
+                v-if="!hasOtherSplitOrder"
+            >
                 继续购买
                 继续购买
             </tui-button>
             </tui-button>
+            <tui-button type="base" width="600rpx" height="90rpx" shape="circle" :size="28" @click="toRePay" v-else>
+                继续支付
+            </tui-button>
             <tui-button
             <tui-button
                 type="base"
                 type="base"
                 :plain="true"
                 :plain="true"
@@ -26,23 +37,38 @@
             >
             >
                 查看订单
                 查看订单
             </tui-button>
             </tui-button>
-            <view class="share"> <text class="btn-tip">分享后可获得优惠券领取资格</text> </view>
+            <view class="share" 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>
     </view>
     </view>
 </template>
 </template>
 
 
 <script>
 <script>
+import { fetchCouponDisplay } from '@/services/api/coupon.js'
+import { orderShare } from '@/services/api/order.js'
+import { queryStringify } from '@/common/utils.js'
+import { mapGetters } from 'vuex'
 export default {
 export default {
     data() {
     data() {
         return {
         return {
-            orderInfo: {
-                collageId: '0',
-                orderId: '18897',
-                orderMark: '#18897#',
-                orderNo: 'H164783438949249',
-                payTotalFee: '0',
-                payableAmount: '0'
-            }
+            orderInfo: {},
+            mapStateArr: [11, 12, 13, 21, 22, 23, 111],
+            orderDetail: {},
+            couponTipStr: '',
+            posterData: {}
+        }
+    },
+    computed: {
+        ...mapGetters(['userId']),
+        hasOtherSplitOrder() {
+            return this.mapStateArr.includes(parseInt(this.orderDetail.status))
+        },
+        canShare() {
+            return this.couponTipStr.indexOf('3') > -1
         }
         }
     },
     },
     beforeDestroy() {
     beforeDestroy() {
@@ -50,13 +76,62 @@ export default {
     },
     },
     onLoad() {
     onLoad() {
         this.orderInfo = uni.getStorageSync('PAY_ORDER_INFO')
         this.orderInfo = uni.getStorageSync('PAY_ORDER_INFO')
+        this.getOrderDetail()
+    },
+    onShareAppMessage() {
+        // 加密
+        const state_str = encodeURIComponent(this.$crypto.encrypt({ type: 0 }))
+        return {
+            title: '护肤上颜选,正品有好货~',
+            path: `/pages/index/index?state_str=${state_str}`,
+            imageUrl: this.staticUrl + 'icon-share.png'
+        }
     },
     },
     methods: {
     methods: {
+        // 分享结束
+        async onAfterShare() {
+            try {
+                await orderShare({ orderId: this.orderInfo.orderId, userId: this.userId })
+                this.$toast('分享成功')
+            } catch (e) {
+                this.$toast('分享失败')
+            }
+        },
+        // 分享
+        onShare() {
+            this.posterData = { query: queryStringify({ type: 0 }) }
+            this.$refs.sharePopup.open()
+        },
+        // 获取可领取优惠券类型
+        async fetchCouponDisplay() {
+            try {
+                const res = await fetchCouponDisplay({ userId: this.userId })
+                this.couponTipStr = res.data
+            } catch (e) {
+                console.log('获取优惠券类型失败')
+            }
+        },
+        // 继续购买
         toBuy() {
         toBuy() {
             this.$router.switchTab('home')
             this.$router.switchTab('home')
         },
         },
+        // 订单列表
         onSearch() {
         onSearch() {
             this.$router.redirectTo('order/order-list')
             this.$router.redirectTo('order/order-list')
+        },
+        // 继续支付
+        toRePay() {
+            this.$router.redirectTo(`order/order-pay?orderId=${this.orderInfo.orderId}`)
+        },
+        // 获取订单支付列表
+        async getOrderDetail() {
+            try {
+                const { data } = await fetchOrderDetail({ orderId: this.orderInfo.orderId })
+                this.orderDetail = data.order
+            } catch (e) {
+                console.log('获取订单信息失败')
+                console.log(e)
+            }
         }
         }
     }
     }
 }
 }

+ 20 - 12
pages/views/share-buy/share-buy-detail.vue

@@ -46,7 +46,7 @@
 
 
 <script>
 <script>
 import { fetchCollageOrderDetail } from '@/services/api/order.js'
 import { fetchCollageOrderDetail } from '@/services/api/order.js'
-import { countDown } from '@/common/utils.js'
+import { countDown, queryStringify } from '@/common/utils.js'
 import { mapGetters } from 'vuex'
 import { mapGetters } from 'vuex'
 export default {
 export default {
     data() {
     data() {
@@ -55,13 +55,7 @@ export default {
             collageId: '',
             collageId: '',
             collageData: {},
             collageData: {},
             // 海报生成数据
             // 海报生成数据
-            posterData: {
-                porductName: '',
-                productPrice: '',
-                productOriginPrice: '',
-                productImage: '',
-                qrCodeImage: '' // 商品详情二维码
-            },
+            posterData: {},
             timer: null,
             timer: null,
             countDownTime: {}
             countDownTime: {}
         }
         }
@@ -92,6 +86,23 @@ export default {
         this.fetchOrderDetails()
         this.fetchOrderDetails()
     },
     },
     methods: {
     methods: {
+        // 分享
+        async onShare() {
+            const query = queryStringify({
+                type: 4,
+                collageId: this.collageData.collageId,
+                initiatorId: this.userId
+            })
+            this.posterData = {
+                porductName: '哈喽,赶快来参团吧!这件商品拼团买更便宜~',
+                productPrice: this.collageData.price,
+                productOriginPrice: this.collageData.normalPrice,
+                productImage: this.collageData.productImage,
+                query: query
+            }
+            this.$refs.sharePopup.open()
+        },
+
         // 获取拼单详情
         // 获取拼单详情
         async fetchOrderDetails() {
         async fetchOrderDetails() {
             try {
             try {
@@ -123,10 +134,7 @@ export default {
         handleToHome() {
         handleToHome() {
             this.$router.switchTab('home')
             this.$router.switchTab('home')
         },
         },
-        // 分享
-        async onShare() {
-            this.$refs.sharePopup.open()
-        },
+
         // 倒计时
         // 倒计时
         countDown() {
         countDown() {
             const startTime = Date.now()
             const startTime = Date.now()

+ 13 - 1
pages/views/share-buy/share-buy-entry.vue

@@ -9,7 +9,11 @@
         <view class="group-message">
         <view class="group-message">
             <share-buy-group-message :countDownTime="countDownTime">
             <share-buy-group-message :countDownTime="countDownTime">
                 <template v-slot:head>
                 <template v-slot:head>
-                    <view class="message">还差<text v-text="collageData.needNum"></text>人参团,距离结束还剩:</view>
+                    <view class="message">
+                        还差
+                        <text v-text="collageData.needNum"></text>
+                        人参团,距离结束还剩:
+                    </view>
                 </template>
                 </template>
                 <template v-slot:foot>
                 <template v-slot:foot>
                     <tui-button type="base" width="600rpx" height="90rpx" shape="circle" :size="30" @click="onSubmit">
                     <tui-button type="base" width="600rpx" height="90rpx" shape="circle" :size="30" @click="onSubmit">
@@ -89,6 +93,14 @@ export default {
         countDown() {
         countDown() {
             const startTime = Date.now()
             const startTime = Date.now()
             const endTime = new Date(this.collageData.endTime).getTime()
             const endTime = new Date(this.collageData.endTime).getTime()
+
+            // 拼团已结束
+            if (endTime < startTime) {
+                this.$toast('拼团已结束')
+                setTimeout(() => this.$router.switchTab('home'), 1000)
+                return
+            }
+
             this.timer && clearTimeout(this.timer)
             this.timer && clearTimeout(this.timer)
             countDown(endTime, startTime, {}, item => {
             countDown(endTime, startTime, {}, item => {
                 this.countDownTime = item.conttainer
                 this.countDownTime = item.conttainer

+ 18 - 10
services/api/auth.js

@@ -2,19 +2,27 @@ import request from '@/services/http.request.js'
 
 
 /* 微信授权登录 */
 /* 微信授权登录 */
 export function wechatAuthLogin(params) {
 export function wechatAuthLogin(params) {
-	return request({
-		url: '/user/he/authorization',
-		method: 'GET',
-		params
-	})
+    return request({
+        url: '/user/he/authorization',
+        method: 'GET',
+        params
+    })
 }
 }
 
 
 /* 手机号验证登录 */
 /* 手机号验证登录 */
 export function mobileLogin(data) {
 export function mobileLogin(data) {
-	return request({
-		url: '/user/he/mobile/login',
-		method: 'POST',
-		data
-	})
+    return request({
+        url: '/user/he/mobile/login',
+        method: 'POST',
+        data
+    })
 }
 }
 
 
+/* 获取token */
+export function getAccessToken(data) {
+    return request({
+        url: '/user/he/access/token',
+        method: 'get',
+        data
+    })
+}

+ 9 - 0
services/api/coupon.js

@@ -71,3 +71,12 @@ export function fetchCouponListByProductIds(params) {
         params
         params
     })
     })
 }
 }
+
+/* 获取可领取优惠券类型 */
+export function fetchCouponDisplay(params) {
+    return request({
+        url: '/coupon/share/display',
+        method: 'GET',
+        params
+    })
+}

+ 1 - 1
services/api/goods.js

@@ -84,7 +84,7 @@ export function fetchProductActivityDetail(params) {
 /* 获取一级商品分类列表 */
 /* 获取一级商品分类列表 */
 export function fetchProductTypeFirst(params) {
 export function fetchProductTypeFirst(params) {
     return request({
     return request({
-        url: '/product/type/first',
+        url: '/product/classify',
         method: 'GET',
         method: 'GET',
         params
         params
     })
     })

+ 9 - 0
services/api/order.js

@@ -147,3 +147,12 @@ export function clearOrderSearchHistory(params) {
 		params
 		params
 	})
 	})
 }
 }
+
+/* 清除订单搜索记录 */
+export function orderShare(data) {
+	return request({
+		url: '/order/share',
+		method: 'POST',
+		data
+	})
+}

+ 1 - 0
store/getters.js

@@ -6,6 +6,7 @@ const getters = {
     nickName: state => state.user.nickName,
     nickName: state => state.user.nickName,
     userIdentity: state => state.user.userIdentity,
     userIdentity: state => state.user.userIdentity,
     userId: state => state.user.userId,
     userId: state => state.user.userId,
+    accessToken: state => state.user.accessToken,
     unusedNum: state => state.coupon.unusedNum,
     unusedNum: state => state.coupon.unusedNum,
     expiredNum: state => state.coupon.expiredNum,
     expiredNum: state => state.coupon.expiredNum,
     usedNum: state => state.coupon.usedNum,
     usedNum: state => state.coupon.usedNum,

+ 18 - 2
store/modules/user.js

@@ -1,4 +1,4 @@
-import { wechatAuthLogin, mobileLogin } from '@/services/api/auth.js'
+import { wechatAuthLogin, mobileLogin, getAccessToken } from '@/services/api/auth.js'
 import { wxLogin } from '@/common/auth.js'
 import { wxLogin } from '@/common/auth.js'
 import { setStorage } from '@/common/storage.js'
 import { setStorage } from '@/common/storage.js'
 import { objAssign } from '@/common/utils.js'
 import { objAssign } from '@/common/utils.js'
@@ -11,7 +11,8 @@ const state = {
     openId: 'oFFip5SgfBKMHxgZLInIBTHdPGuk',
     openId: 'oFFip5SgfBKMHxgZLInIBTHdPGuk',
     userId: 0,
     userId: 0,
     userIdentity: -1, // 用户类型
     userIdentity: -1, // 用户类型
-    inviteUserId: '' // 分享者用户ID
+    inviteUserId: '', // 分享者用户ID
+    accessToken: ''
 }
 }
 
 
 const mutations = {
 const mutations = {
@@ -20,6 +21,9 @@ const mutations = {
     },
     },
     SET_INVITE_USER_ID: (state, id) => {
     SET_INVITE_USER_ID: (state, id) => {
         state.inviteUserId = id
         state.inviteUserId = id
+    },
+    SET_ACCESS_TOKEN: (state, token) => {
+        state.accessToken = token
     }
     }
 }
 }
 
 
@@ -49,6 +53,18 @@ const actions = {
             return Promise.reject(e)
             return Promise.reject(e)
         }
         }
     },
     },
+    // 获取accessToken
+    async getAccessToken({ commit }) {
+        try {
+            const { data } = await getAccessToken()
+            commit('SET_ACCESS_TOKEN', data)
+            return Promise.resolve(data)
+        } catch (e) {
+            console.log(e)
+            console.log('获取accessToken失败')
+            return Promise.reject(e)
+        }
+    }
 }
 }
 
 
 export default {
 export default {