Pārlūkot izejas kodu

Merge branch 'develop_yh1.0' of chelingzhu-web/zxyj-mini-html into master

lilei 4 gadi atpakaļ
vecāks
revīzija
e4aee02323
62 mainītis faili ar 2803 papildinājumiem un 124 dzēšanām
  1. 1 1
      App.vue
  2. 110 0
      almost-utils/almost-utils.js
  3. 164 0
      almost-utils/image-tools.js
  4. 70 0
      api/luckyDraw.js
  5. 721 0
      components/almost-lottery/almost-lottery.vue
  6. 2 2
      components/uni-cart-fix/uni-cart-fix.vue
  7. 1 1
      components/uni-coods/uni-coods.vue
  8. 120 74
      pages.json
  9. 5 0
      pages/agreement/agreement.vue
  10. 5 0
      pages/checkOut/checkFinish.vue
  11. 5 0
      pages/checkOut/checkOut.vue
  12. 6 1
      pages/goods/index.vue
  13. 122 6
      pages/index/index.vue
  14. 7 2
      pages/login/login.vue
  15. 22 4
      pages/login/phoneLogin.vue
  16. 5 0
      pages/store/store.vue
  17. 9 0
      pages/userCenter/aboutUs.vue
  18. 7 0
      pages/userCenter/deliveryRecord.vue
  19. 18 13
      pages/userCenter/fenlei.vue
  20. 11 4
      pages/userCenter/index.vue
  21. 5 0
      pages/userCenter/ldDetailed.vue
  22. 5 0
      pages/userCenter/myCode/myCode.vue
  23. 9 0
      pages/userCenter/question.vue
  24. 8 1
      pages/userCenter/userInfo/userInfo.vue
  25. 9 0
      pages/userCenter/zhinan.vue
  26. 6 1
      pagesA/cart/cart.vue
  27. 5 0
      pagesA/goods/goods.vue
  28. 7 2
      pagesA/goods/goodsDetail.vue
  29. 642 0
      pagesA/luckDraw/luckDraw.vue
  30. 407 0
      pagesA/luckDraw/myJp.vue
  31. 81 0
      pagesA/luckDraw/paySuccess.vue
  32. 5 0
      pagesA/order/LogList.vue
  33. 8 6
      pagesA/order/order.vue
  34. 6 1
      pagesA/order/orderDetail.vue
  35. 166 0
      pagesA/taskList/taskList.vue
  36. 5 0
      pagesA/toOrder/editAddress.vue
  37. 8 3
      pagesA/toOrder/index.vue
  38. 6 1
      pagesA/toOrder/payFinish.vue
  39. BIN
      static/FIRST_DELIVERY.png
  40. BIN
      static/FIRST_ONLINE_EXCHANGE.png
  41. BIN
      static/NEW_CUSTOMER.png
  42. BIN
      static/NEW_FIRST_DELIVER.png
  43. BIN
      static/OLD_FIRST_DELIVER.png
  44. BIN
      static/SHARE_FRIEND.png
  45. BIN
      static/almost-lottery/almost-lottery__action.png
  46. BIN
      static/almost-lottery/almost-lottery__action2x.png
  47. BIN
      static/almost-lottery/almost-lottery__action3x.png
  48. BIN
      static/almost-lottery/almost-lottery__bg.png
  49. BIN
      static/almost-lottery/almost-lottery__bg2x.png
  50. BIN
      static/almost-lottery/almost-lottery__bg3x.png
  51. BIN
      static/closeLottery.png
  52. BIN
      static/lottery-cjgz.png
  53. BIN
      static/lottery_winbg1.png
  54. BIN
      static/lottery_winbg2.png
  55. BIN
      static/luckwheel-fixed1.gif
  56. BIN
      static/nozj.png
  57. BIN
      static/shift.png
  58. BIN
      static/tdsm.jpg
  59. BIN
      static/toLottery.png
  60. BIN
      static/zpIcon.png
  61. BIN
      static/zpthumbr.jpg
  62. 4 1
      store/index.js

+ 1 - 1
App.vue

@@ -1,6 +1,6 @@
 <script>
 	const uat_domain = 'https://lese.test.sxzxyj.net' // 预发布
-	// const uat_domain = 'http://192.168.16.103:8302' // 本地
+	// const uat_domain = 'http://192.168.16.105:8302' // 本地
 	const pro_domain = 'https://lese.sxzxyj.net' // 生产
 	const uat_URL = uat_domain+'/gc-shop/' // 预发布
 	const pro_URL = pro_domain+'/gc-shop/'  // 生产

+ 110 - 0
almost-utils/almost-utils.js

@@ -0,0 +1,110 @@
+/**
+ * 存储 localStorage 数据
+ * @param {String} name - 缓存数据的标识
+ * @param {any} content - 缓存的数据内容
+ */
+export const setStore = (name, content) => {
+  if (!name) return
+  if (typeof content !== 'string') {
+    content = JSON.stringify(content)
+  }
+	uni.setStorageSync(name, content)
+}
+
+/**
+ * 获取 localStorage 数据
+ * @param {String} name - 缓存数据的标识
+ */
+export const getStore = (name) => {
+  if (!name) return
+  return uni.getStorageSync(name)
+}
+
+/**
+ * 清除 localStorage 数据
+ * @param {String} name - 缓存数据的标识
+ */
+export const clearStore = (name) => {
+  if (name) {
+		uni.removeStorageSync(name)
+  } else {
+    console.log('清理本地全部缓存')
+    uni.clearStorageSync()
+  }
+}
+
+/**
+ * 下载文件,并返回临时路径
+ * @return {String}  临时路径
+ * @param {String} fileUrl - 网络地址
+*/
+export const downloadFile = (fileUrl) => {
+  return new Promise((resolve) => {
+    uni.downloadFile({
+      url: fileUrl,
+      success: (res) => {
+        // #ifdef MP-ALIPAY
+        if (res.errMsg === 'downloadFile:ok') {
+          resolve({
+            ok: true,
+            tempFilePath: res.tempFilePath
+          })
+        } else {
+          resolve({
+            ok: false,
+            msg: '图片下载失败'
+          })
+        }
+        // #endif
+				// #ifndef MP-ALIPAY
+				if (res.statusCode === 200) {
+				  resolve({
+				    ok: true,
+				    tempFilePath: res.tempFilePath
+				  })
+				} else {
+				  resolve({
+				    ok: false,
+				    msg: '图片下载失败'
+				  })
+				}
+				// #endif
+      },
+      fail: (err) => {
+        resolve({
+          ok: false,
+          msg: `图片下载失败,${err}`
+        })
+      }
+    })
+  })
+}
+
+/**
+ * 清理应用已缓存的文件
+*/
+export const clearCacheFile = () => {
+	// #ifndef H5
+	uni.getSavedFileList({
+		success: (res) => {
+			let fileList = res.fileList
+			if (fileList.length) {
+				for (let i = 0; i < fileList.length; i++) {
+					uni.removeSavedFile({
+						filePath: fileList[i].filePath,
+						complete: () => {
+							console.log('清除缓存已完成')
+						}
+					})
+				}
+			}
+		},
+		fail: (err) => {
+			console.log('getSavedFileList Fail')
+		}
+	})
+	// #endif
+	// #ifdef H5
+	clearStore()
+	// #endif
+}

+ 164 - 0
almost-utils/image-tools.js

@@ -0,0 +1,164 @@
+// 图像转换工具,可用于图像和base64的转换
+// https://ext.dcloud.net.cn/plugin?id=123
+
+const getLocalFilePath = (path) => {
+  if (
+    path.indexOf('_www') === 0 ||
+    path.indexOf('_doc') === 0 ||
+    path.indexOf('_documents') === 0 ||
+    path.indexOf('_downloads') === 0
+  ) return path
+
+  if (path.indexOf('/storage/emulated/0/') === 0) return path
+	
+  if (path.indexOf('/storage/sdcard0/') === 0) return path
+
+  if (path.indexOf('/var/mobile/') === 0) return path
+
+  if (path.indexOf('file://') === 0) return path
+
+  if (path.indexOf('/') === 0) {
+		// ios 无法获取本地路径
+    let localFilePath = plus.os.name === 'iOS' ? path : plus.io.convertLocalFileSystemURL(path)
+    if (localFilePath !== path) {
+      return localFilePath
+    } else {
+      path = path.substring(1)
+    }
+  }
+	
+  return '_www/' + path
+}
+
+export const pathToBase64 = (path) => {
+	return new Promise((resolve, reject) => {
+		if (typeof window === 'object' && 'document' in window) {
+			if (typeof FileReader === 'function') {
+				let xhr = new XMLHttpRequest()
+				xhr.open('GET', path, true)
+				xhr.responseType = 'blob'
+				xhr.onload = function() {
+					if (this.status === 200) {
+						let fileReader = new FileReader()
+						fileReader.onload = function(e) {
+							resolve(e.target.result)
+						}
+						fileReader.onerror = reject
+						fileReader.readAsDataURL(this.response)
+					}
+				}
+				xhr.onerror = reject
+				xhr.send()
+				return
+			}
+			let canvas = document.createElement('canvas')
+			let c2x = canvas.getContext('2d')
+			let img = new Image
+			img.onload = function() {
+				canvas.width = img.width
+				canvas.height = img.height
+				c2x.drawImage(img, 0, 0)
+				resolve(canvas.toDataURL())
+				canvas.height = canvas.width = 0
+			}
+			img.onerror = reject
+			img.src = path
+			return
+		}
+		
+		if (typeof plus === 'object') {
+			let tempPath = getLocalFilePath(path)
+			plus.io.resolveLocalFileSystemURL(tempPath, (entry) => {
+				entry.file((file) => {
+					let fileReader = new plus.io.FileReader()
+					fileReader.onload = function(data) {
+						resolve(data.target.result)
+					}
+					fileReader.onerror = function(error) {
+						console.log(error)
+						reject(error)
+					}
+					fileReader.readAsDataURL(file)
+				}, (error) => {
+					reject(error)
+				})
+			}, (error) => {
+				reject(error)
+			})
+			return
+		}
+		
+		if (typeof wx === 'object' && wx.canIUse('getFileSystemManager')) {
+			wx.getFileSystemManager().readFile({
+				filePath: path,
+				encoding: 'base64',
+				success: (res) => {
+					resolve('data:image/png;base64,' + res.data)
+				},
+				fail: (error) => {
+					reject(error)
+				}
+			})
+			return
+		}
+		reject(new Error('not support'))
+	})
+}
+
+export const base64ToPath = (base64) => {
+	return new Promise((resolve, reject) => {
+		if (typeof window === 'object' && 'document' in window) {
+			base64 = base64.split(',')
+			let type = base64[0].match(/:(.*?);/)[1]
+			let str = atob(base64[1])
+			let n = str.length
+			let array = new Uint8Array(n)
+			while (n--) {
+				array[n] = str.charCodeAt(n)
+			}
+			return resolve((window.URL || window.webkitURL).createObjectURL(new Blob([array], {
+				type: type
+			})))
+		}
+		let extName = base64.match(/data\:\S+\/(\S+);/)
+		if (extName) {
+			extName = extName[1]
+		} else {
+			reject(new Error('base64 error'))
+		}
+		let fileName = Date.now() + '.' + extName
+		if (typeof plus === 'object') {
+			let bitmap = new plus.nativeObj.Bitmap('bitmap' + Date.now())
+			bitmap.loadBase64Data(base64, () => {
+				let filePath = '_doc/uniapp_temp/' + fileName
+				bitmap.save(filePath, {}, () => {
+					bitmap.clear()
+					resolve(filePath)
+				}, (error) => {
+					bitmap.clear()
+					reject(error)
+				})
+			}, (error) => {
+				bitmap.clear()
+				reject(error)
+			})
+			return
+		}
+		if (typeof wx === 'object' && wx.canIUse('getFileSystemManager')) {
+			let filePath = wx.env.USER_DATA_PATH + '/' + fileName
+			wx.getFileSystemManager().writeFile({
+				filePath: filePath,
+				data: base64.replace(/^data:\S+\/\S+;base64,/, ''),
+				encoding: 'base64',
+				success: () => {
+					resolve(filePath)
+				},
+				fail: (error) => {
+					reject(error)
+				}
+			})
+			return
+		}
+		reject(new Error('not support'))
+	})
+}

+ 70 - 0
api/luckyDraw.js

@@ -0,0 +1,70 @@
+import axios from '@/libs/axios.js';
+// 获取是否有转盘
+export const findEnable = params => {
+  return axios.request({
+    url: `luckyDraw/findEnable`,
+    method: 'get',
+  })
+};
+// 抽奖takeOut
+export const takeOut = params => {
+  return axios.request({
+    url: `luckyDraw/takeOut/${params.id}`,
+    method: 'get',
+  })
+};
+// 获取免费抽奖次数
+export const findCustomerTimes = params => {
+  return axios.request({
+    url: `luckyDrawCust/findCustomerTimes/${params.id}`,
+    method: 'get',
+  })
+};
+// 获取任务列表
+export const findCustomerTask = params => {
+  return axios.request({
+    url: `luckyDrawCust/findCustomerTask/${params.id}`,
+    method: 'get',
+  })
+};
+// 购买抽奖次数
+export const buyDrawTimes = params => {
+  return axios.request({
+    url: `luckyDrawCust/buyDrawTimes`,
+    method: 'post',
+	data: params
+  })
+};
+// 获取已中奖列表
+export const findWinPrize = params => {
+  return axios.request({
+    url: `luckyDrawCust/findWinPrize`,
+    method: 'get',
+  })
+};
+
+// 领奖
+export const receive = params => {
+  return axios.request({
+    url: `luckyDrawCust/receive`,
+    method: 'post',
+	data: params
+  })
+};
+
+// 获奖记录
+export const queryWinRecord = params => {
+  return axios.request({
+    url: `luckyDraw/queryWinRecord/${params.pageNo}/${params.pageSize}`,
+    method: 'post',
+	data: params
+  })
+};
+
+// 抽奖任务
+export const doTask = params => {
+  return axios.request({
+    url: `luckyDrawCust/doTask/${params.luckyDrawNo}/${params.taskCode}`,
+    method: 'get',
+  })
+};

+ 721 - 0
components/almost-lottery/almost-lottery.vue

@@ -0,0 +1,721 @@
+<template>
+  <view class="almost-lottery" :style="{ width: canvasWidth + 40 + 'px', height: canvasHeight + 40 + 'px'}">
+    <view class="almost-lottery__wrap" :style="{width: canvasWidth + canvasMarginTotal + 'px', height: canvasHeight + canvasMarginTotal + 'px'}">
+      <!-- #ifdef MP-ALIPAY -->
+      <canvas :class="className" :id="canvasId" :width="canvasWidth" :height="canvasHeight" :style="{
+         width: canvasWidth + 'px',
+         height: canvasHeight + 'px'
+       }" />
+      <!-- #endif -->
+      <!-- #ifndef MP-ALIPAY -->
+      <canvas :class="className" :canvas-id="canvasId" :width="canvasWidth" :height="canvasHeight" :style="{
+         width: canvasWidth + 'px',
+         height: canvasHeight + 'px'
+       }" />
+      <!-- #endif -->
+      <image class="canvas-img" :src="lotteryImg" :style="{
+         width: canvasWidth + canvasMarginTotal + 'px',
+         height: canvasHeight + canvasMarginTotal + 'px',
+         transform: `rotate(${canvasAngle + targetAngle}deg)`,
+         transitionDuration: `${transitionDuration}s`
+       }"
+        v-if="lotteryImg"></image>
+      <view class="almost-lottery__action" :style="{
+         width: actionSize + 'px',
+         height: actionSize + 'px'
+       }" @click="handleActionStart"></view>
+      <!-- 为了兼容 app 端 ctx.measureText 所需的标签 -->
+      <text class="almost-lottery__measureText">{{ measureText }}</text>
+    </view>
+  </view>
+</template>
+
+<script>
+	import { pathToBase64 } from '@/almost-utils/image-tools.js'
+	import { getStore, setStore, clearStore, downloadFile } from '@/almost-utils/almost-utils.js'
+  export default {
+    name: 'AlmostLottery',
+    props: {
+      // canvas 宽度
+      canvasWidth: {
+        type: Number,
+        default: 240
+      },
+      // canvas 高度
+      canvasHeight: {
+        type: Number,
+        default: 240
+      },
+      // 奖品列表
+      prizeList: {
+        type: Array,
+        required: true,
+        validator: (value) => {
+          return value.length > 1
+        }
+      },
+      // 中奖奖品在列表中的下标
+      prizeIndex: {
+        type: Number,
+        required: true
+      },
+      // 奖品区块对应背景颜色
+      colors: {
+        type: Array,
+        default: () => [
+          '#FFFFFF',
+          '#FFE9AA'
+        ]
+      },
+      // 旋转动画时间 单位s
+      duration: {
+        type: Number,
+        default: 8
+      },
+      // 旋转的圈数
+      ringCount: {
+        type: Number,
+        default: 8
+      },
+      // 指针位置
+      pointerPosition: {
+        type: String,
+        default: 'edge',
+        validator: (value) => {
+          return value === 'edge' || value === 'middle'
+        }
+      },
+      // 字体颜色
+      fontColor: {
+        type: String,
+        default: '#C30B29'
+      },
+      // 文字的大小
+      fontSize: {
+        type: Number,
+        default: 12
+      },
+      // 奖品文字多行情况下的行高
+      lineHeight: {
+        type: Number,
+        default: 16
+      },
+      // 奖品名称所对应的 key 值
+      strKey: {
+        type: String,
+        default: 'name'
+      },
+      // 奖品文字总长度限制
+      strMaxLen: {
+        type: Number,
+        default: 12
+      },
+      // 奖品文字多行情况下第一行文字长度
+      strLineLen: {
+        type: Number,
+        default: 6
+      },
+      // 奖品图片的宽
+      imageWidth: {
+        type: Number,
+        default: 30
+      },
+      // 奖品图片的高
+      imageHeight: {
+        type: Number,
+        default: 30
+      },
+			// 转盘绘制成功的提示
+			successMsg: {
+				type: String,
+				default: '奖品准备就绪,快来参与抽奖吧'
+			},
+			// 转盘绘制失败的提示
+			failMsg: {
+				type: String,
+				default: '奖品仍在准备中,请稍后再来...'
+			},
+			// 是否开启画板的缓存
+			canvasCached: {
+				type: Boolean,
+				default: true
+			},
+			// 内圈与外圈的间距
+			canvasMargin: {
+        type: Number,
+        default: 5
+      }
+    },
+    data() {
+      return {
+        // 画板className
+        className: 'almost-lottery__canvas',
+        // 画板标识
+        canvasId: 'almostLotteryCanvas',
+        // 画板导出的图片
+        lotteryImg: '',
+        // 旋转到奖品目标需要的角度
+        targetAngle: 0,
+        // 旋转动画时间 单位 s
+        transitionDuration: 0,
+        // 是否正在旋转
+        isRotate: false,
+        // 当前停留在那个奖品的序号
+        stayIndex: 0,
+        // 当前中奖奖品的序号
+        targetIndex: 0,
+				// 是否存在可用的缓存转盘图
+				isCacheImg: false,
+				oldLotteryImg: '',
+        // 解决 app 不支持 measureText 的问题
+				// app 已在 2.9.3 的版本中提供了对 measureText 的支持,将在后续版本逐渐稳定后移除相关兼容代码
+        measureText: ''
+      }
+    },
+    computed: {
+      // 根据奖品列表计算 canvas 旋转角度
+      canvasAngle() {
+        let prizeCount = this.prizeList.length
+        let prizeClip = 360 / prizeCount
+        let result = 0
+
+        let diffNum = 90 / prizeClip
+        if (this.pointerPosition === 'edge') {
+          result = -(prizeClip * diffNum)
+        } else {
+          result = -(prizeClip * diffNum + prizeClip / 2)
+        }
+        return result
+      },
+      // 外圆的半径
+      outsideRadius() {
+        return this.canvasWidth / 2
+      },
+      // 内圆的半径
+      insideRadius() {
+        return 20
+      },
+      // 字体的半径
+      textRadius() {
+        return this.fontSize / 2
+      },
+      // 根据画板的宽度计算奖品文字与中心点的距离
+      textDistance() {
+        const textZeroY = Math.round(this.outsideRadius - (this.insideRadius / 2))
+        return textZeroY - this.textRadius
+      },
+      // 设备像素密度
+      pixelRatio() {
+        return uni.getSystemInfoSync().pixelRatio
+      },
+			// 内圈与外圈的距离
+			canvasMarginTotal () {
+				let diffNum = 5
+				let margin = this.canvasMargin * 2
+				if (this.canvasWidth > 240) {
+					return -(this.canvasWidth / 240 * 2) - margin
+				} else if (this.canvasWidth < 240) {
+					return diffNum + (this.canvasWidth / 240 * 2) - margin
+				} else {
+					return diffNum - margin
+				}
+			},
+			// 抽奖按钮的宽高
+			actionSize () {
+				return this.canvasWidth / 2.4
+			}
+    },
+    watch: {
+      // 监听获奖序号的变动
+      prizeIndex(newVal, oldVal) {
+        if (newVal > -1) {
+          this.targetIndex = newVal
+          this.onRotateStart()
+        } else {
+          console.info('旋转结束,prizeIndex 已重置')
+        }
+      }
+    },
+    methods: {
+	  resetAngle(){
+		  let prizeCount = this.prizeList.length
+		  let prizeClip = 360 / prizeCount
+		  this.targetAngle = this.targetAngle - prizeClip/2
+	  },
+      // 开始旋转
+      onRotateStart() {
+        if (this.isRotate) return
+        this.isRotate = true
+        // 奖品总数
+        let prizeCount = this.prizeList.length
+        let baseAngle = 360 / prizeCount
+        let angles = 0
+        if (this.targetAngle === 0) {
+          // 第一次旋转
+          // 因为第一个奖品是从0°开始的,即水平向右方向
+          // 第一次旋转角度 = 270度 - (停留的序号-目标序号) * 每个奖品区间角度 - 每个奖品区间角度的一半 - canvas自身旋转的度数
+          angles = (270 - (this.targetIndex - this.stayIndex) * baseAngle - baseAngle / 2) - this.canvasAngle
+        } else {
+          // 后续旋转
+          // 后续继续旋转 就只需要计算停留的位置与目标位置的角度
+          angles = -(this.targetIndex - this.stayIndex) * baseAngle
+        }
+        // 更新目前序号
+        this.stayIndex = this.targetIndex
+        // 转 8 圈,圈数越多,转的越快
+        this.targetAngle += angles + 360 * this.ringCount
+
+        // 计算转盘结束的时间,预加一些延迟确保转盘停止后触发结束事件
+        let endTime = this.transitionDuration * 1000 + 100
+        let endTimer = setTimeout(() => {
+          clearTimeout(endTimer)
+          endTimer = null
+
+          this.isRotate = false
+          this.$emit('draw-end')
+        }, endTime)
+
+        let resetPrizeTimer = setTimeout(() => {
+          clearTimeout(resetPrizeTimer)
+          resetPrizeTimer = null
+
+          // 每次抽奖结束后都要重置父级附件的 prizeIndex
+          this.$emit('reset-index')
+        }, endTime + 50)
+      },
+      // 点击 开始抽奖 按钮
+      handleActionStart() {
+        this.$emit('draw-start')
+      },
+      // 渲染转盘
+      async onCreateCanvas() {
+        // 获取 canvas 画布
+        const canvasId = this.canvasId
+        const ctx = uni.createCanvasContext(canvasId, this)
+
+        // canvas 的宽高
+        let canvasW = this.canvasWidth
+        let canvasH = this.canvasHeight
+
+        // 根据奖品个数计算 角度
+        let prizeCount = this.prizeList.length
+        let baseAngle = Math.PI * 2 / prizeCount
+
+        // 设置描边颜色
+        ctx.setStrokeStyle('#FFBE04')
+
+        // 设置字体和字号
+        // #ifndef MP
+        let fontFamily =
+          '-apple-system, BlinkMacSystemFont, \'PingFang SC\', \'Helvetica Neue\', STHeiti, \'Microsoft Yahei\', Tahoma, Simsun, sans-serif'
+        ctx.font = `${this.fontSize}px ${fontFamily}`
+        // #endif
+        // #ifdef MP
+        ctx.setFontSize(this.fontSize)
+        // #endif
+
+        // 注意,开始画的位置是从0°角的位置开始画的。也就是水平向右的方向。
+        // 画具体内容
+        for (let i = 0; i < prizeCount; i++) {
+					let prizeItem = this.prizeList[i]
+          // 当前角度
+          let angle = i * baseAngle
+
+          // 保存当前画布的状态
+          ctx.save()
+
+          // 开始画内容
+          ctx.beginPath()
+
+          // 开始画圆弧
+          // x => 圆弧对应的圆心横坐标 x
+          // y => 圆弧对应的圆心横坐标 y
+          // radius => 圆弧的半径大小
+          // startAngle => 圆弧开始的角度,单位是弧度
+          // endAngle => 圆弧结束的角度,单位是弧度
+          // anticlockwise(可选) => 绘制方向,true 为逆时针,false 为顺时针
+          ctx.arc(canvasW * 0.5, canvasH * 0.5, this.outsideRadius, angle, angle + baseAngle, false)
+          ctx.arc(canvasW * 0.5, canvasH * 0.5, this.insideRadius, angle + baseAngle, angle, true)
+
+          // 开始链接线条
+          ctx.stroke()
+          // 每个奖品区块背景填充颜色
+          if (this.colors.length === 2) {
+            ctx.setFillStyle(this.colors[i % 2])
+          } else {
+            ctx.setFillStyle(this.colors[i])
+          }
+          // 填充颜色
+          ctx.fill()
+
+          // 开始绘制奖品内容
+          // 重新映射画布上的 (0,0) 位置
+          let translateX = canvasW * 0.5 + Math.cos(angle + baseAngle / 2) * this.textDistance
+          let translateY = canvasH * 0.5 + Math.sin(angle + baseAngle / 2) * this.textDistance
+          ctx.translate(translateX, translateY)
+
+          // 绘制奖品名称
+          ctx.setFillStyle(this.fontColor)
+          let rewardName = this.strLimit(prizeItem[this.strKey])
+
+          // rotate方法旋转当前的绘图,因为文字是和当前扇形中心线垂直的
+          ctx.rotate(angle + (baseAngle / 2) + (Math.PI / 2))
+
+          // 设置文本位置并处理换行
+          // 是否需要换行
+          let isLineBreak = rewardName.length > this.strLineLen
+          let textOffsetX = this.fontSize === 12 ? 0 : this.textRadius
+          if (isLineBreak) {
+            // 获得多行文本数组
+            rewardName = rewardName.substring(0, this.strLineLen) + ',' + rewardName.substring(this.strLineLen)
+            let rewardNames = rewardName.split(',')
+
+            // 循环文本数组,计算每一行的文本宽度
+            for (let j = 0; j < rewardNames.length; j++) {
+              if (ctx.measureText && ctx.measureText(rewardNames[j]).width) {
+                // 文本的宽度信息
+                let tempStrSize = ctx.measureText(rewardNames[j])
+                ctx.fillText(rewardNames[j], -(tempStrSize.width / 2 + textOffsetX), j * this.lineHeight)
+              } else {
+                this.measureText = rewardNames[j]
+
+                // 等待页面重新渲染
+                await this.$nextTick()
+
+                let textWidth = await this.getTextWidth()
+
+                ctx.fillText(rewardNames[j], -(textWidth / 2 + textOffsetX), j * this.lineHeight)
+                // console.log(rewardNames[j], textWidth, i)
+              }
+            }
+          } else {
+            if (ctx.measureText && ctx.measureText(rewardName).width) {
+              // 文本的宽度信息
+              let tempStrSize = ctx.measureText(rewardName)
+              ctx.fillText(rewardName, -(tempStrSize.width / 2 + textOffsetX), 0)
+            } else {
+              this.measureText = rewardName
+
+              // 等待页面重新渲染
+              await this.$nextTick()
+
+              let textWidth = await this.getTextWidth()
+              ctx.fillText(rewardName, -(textWidth / 2 + textOffsetX), 0)
+            }
+          }
+
+          // 绘制奖品图片
+          if (prizeItem.prizeImage) {
+						// App-Android平台 系统 webview 更新到 Chrome84+ 后 canvas 组件绘制本地图像 uni.canvasToTempFilePath 会报错
+						// 统一将图片处理成 base64
+						// https://ask.dcloud.net.cn/question/103303
+						let reg = /^(https|http)/g
+						// 处理远程图片
+						if (reg.test(prizeItem.prizeImage)) {
+							console.warn('###当前数据列表中的奖品图片为网络图片,开始下载图片...###')
+							let res = await downloadFile(prizeItem.prizeImage)
+							console.log('处理远程图片', res)
+							if (res.ok) {
+								let tempFilePath = res.tempFilePath
+								// #ifndef MP
+								prizeItem.prizeImage = await pathToBase64(tempFilePath)
+								// #endif
+								// #ifdef MP
+								prizeItem.prizeImage = tempFilePath
+								// #endif
+							}
+						} else {
+							// #ifndef MP
+							prizeItem.prizeImage = await pathToBase64(prizeItem.prizeImage)
+							// #endif
+						}
+						
+            ctx.drawImage(prizeItem.prizeImage, -(this.imageWidth / 2), canvasW / 10, this.imageWidth, this.imageHeight)
+          }
+
+          ctx.restore()
+        }
+
+        // 保存绘图并导出图片
+        ctx.draw(true, () => {
+          let drawTimer = setTimeout(() => {
+            clearTimeout(drawTimer)
+            drawTimer = null
+
+            // #ifdef MP-ALIPAY
+            ctx.toTempFilePath({
+              destWidth: this.canvasWidth * this.pixelRatio,
+              destHeight: this.canvasHeight * this.pixelRatio,
+              success: (res) => {
+                // console.log(res.apFilePath)
+                this.handlePrizeImg({
+									ok: true,
+									data: res.apFilePath,
+									msg: '画布导出生成图片成功'
+								})
+              },
+							fail: (err) => {
+                this.handlePrizeImg({
+									ok: false,
+									data: err,
+									msg: '画布导出生成图片失败'
+								})
+							}
+            })
+            // #endif
+            // #ifndef MP-ALIPAY
+            uni.canvasToTempFilePath({
+              destWidth: this.canvasWidth * this.pixelRatio,
+              destHeight: this.canvasHeight * this.pixelRatio,
+              canvasId: this.canvasId,
+              success: (res) => {
+                // 在 H5 平台下,tempFilePath 为 base64
+                // console.log(res.tempFilePath)
+                this.handlePrizeImg({
+									ok: true,
+									data: res.tempFilePath,
+									msg: '画布导出生成图片成功'
+								})
+              },
+							fail: (err) => {
+                this.handlePrizeImg({
+									ok: false,
+									data: err,
+									msg: '画布导出生成图片失败'
+								})
+							}
+            }, this)
+            // #endif
+          }, 500)
+        })
+      },
+      // 处理导出的图片
+      handlePrizeImg(res) {
+				if (res.ok) {
+					let data = res.data
+					
+					if (!this.canvasCached) {
+						this.lotteryImg = data
+						this.handlePrizeImgSuc(res)
+						return
+					}
+					
+					// #ifndef H5
+					if (this.isCacheImg) {
+						uni.getSavedFileList({
+							success: (sucRes) => {
+								let fileList = sucRes.fileList
+								// console.log('getSavedFileList Cached', fileList)
+								
+								let cached = false
+								for (let i = 0; i < fileList.length; i++) {
+									let item = fileList[i]
+									if (item.filePath === data) {
+										cached = true
+										this.lotteryImg = data
+										
+										console.info('经查,本地缓存中存在转盘图可用,本次将不再绘制转盘')
+										this.handlePrizeImgSuc(res)
+										break
+									}
+								}
+								
+								if (!cached) {
+									console.info('经查,本地缓存中存在转盘图不可用,需要重新初始化转盘绘制')
+									this.initCanvasDraw()
+								}
+							},
+							fail: (err) => {
+								this.initCanvasDraw()
+							}
+						})
+					} else {
+						uni.saveFile({
+							tempFilePath: data,
+							success: (sucRes) => {
+								let filePath = sucRes.savedFilePath
+								// console.log('saveFile', filePath)
+								setStore('lotteryImg', filePath)
+								this.lotteryImg = filePath
+								this.handlePrizeImgSuc({
+									ok: true,
+									data: filePath,
+									msg: '画布导出生成图片成功'
+								})
+							},
+							fail: (err) => {
+								this.handlePrizeImg({
+									ok: false,
+									data: err,
+									msg: '画布导出生成图片失败'
+								})
+							}
+						})
+					}
+					// #endif
+					// #ifdef H5
+					console.info('当前为 H5 端,直接使用导出的/缓存中的 base64 图')
+					setStore('lotteryImg', data)
+					this.lotteryImg = data
+					this.handlePrizeImgSuc(res)
+					// #endif
+				} else {
+					console.error('处理导出的图片失败', res)
+					uni.hideLoading()
+					// #ifdef H5
+					console.error('###当前为 H5 端,下载网络图片需要后端配置允许跨域###')
+					// #endif
+					// #ifdef MP
+					console.error('###当前为小程序端,下载网络图片需要配置域名白名单###')
+					// #endif
+				}
+      },
+			// 处理图片完成
+			handlePrizeImgSuc (res) {
+				uni.hideLoading()
+				this.$emit('finish', {
+					ok: res.ok,
+					data: res.data,
+					msg: res.ok ? this.successMsg : this.failMsg
+				})
+			},
+      // 兼容 app 端不支持 ctx.measureText
+      // 已知问题:初始绘制时,低端安卓机 平均耗时 2s
+      getTextWidth() {
+        return new Promise((resolve, reject) => {
+          uni.createSelectorQuery().in(this).select('.almost-lottery__measureText').fields({
+            size: true,
+          }, (res) => {
+            resolve(res.width)
+          }).exec()
+        })
+      },
+      // 处理文字溢出
+      strLimit(value) {
+        let maxLength = this.strMaxLen
+        if (!value || !maxLength) return value
+        return value.length > maxLength ? value.slice(0, maxLength - 1) + '...' : value
+      },
+			// 检查本地缓存中是否存在转盘图
+			checkCacheImg () {
+				console.log('检查本地缓存中是否存在转盘图')
+				// 检查是否已有缓存的转盘图
+				// 检查是否与本次奖品数据相同
+				this.oldLotteryImg = getStore('lotteryImg')
+				let oldPrizeList = getStore('prizeList')
+				let newPrizeList = JSON.stringify(this.prizeList)
+				if (this.oldLotteryImg) {
+					if (oldPrizeList === newPrizeList) {
+						console.log(`经查,本地缓存中存在转盘图 => ${this.oldLotteryImg}`)
+						this.isCacheImg = true
+						
+						console.log('需要继续判断这张缓存图是否可用')
+						this.handlePrizeImg({
+							ok: true,
+							data: this.oldLotteryImg,
+							msg: '画布导出生成图片成功'
+						})
+						return
+					}
+				}
+				
+				console.log('经查,本地缓存中不存在转盘图')
+				this.initCanvasDraw()
+			},
+      // 初始化绘制
+      initCanvasDraw () {
+				console.log('开始初始化转盘绘制')
+				this.isCacheImg = false
+				this.lotteryImg = ''
+				clearStore('lotteryImg')
+        setStore('prizeList', this.prizeList)
+        this.onCreateCanvas()
+      }
+    },
+    mounted() {
+      this.$nextTick(() => {
+        let stoTimer = setTimeout(() => {
+          clearTimeout(stoTimer)
+          stoTimer = null
+					
+					if (this.canvasCached) {
+						this.checkCacheImg()
+					} else {
+						this.onCreateCanvas()
+					}
+          this.transitionDuration = this.duration
+        }, 50)
+      })
+    }
+  }
+</script>
+
+<style lang="scss" scoped>
+  $lotteryBgUrl: '~static/almost-lottery/almost-lottery__bg';
+  $actionBgUrl: '~static/almost-lottery/almost-lottery__action';
+
+  .almost-lottery {
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    margin: 0 auto;
+    background-repeat: no-repeat;
+    background-position: center center;
+    background-size: contain;
+    background-image: url($lotteryBgUrl + ".png");
+
+    @media (-webkit-min-device-pixel-ratio: 2), (min-device-pixel-ratio: 2) {
+      background-image: url($lotteryBgUrl + "2x.png");
+    }
+
+    @media (-webkit-min-device-pixel-ratio: 3), (min-device-pixel-ratio: 3) {
+      background-image: url($lotteryBgUrl + "3x.png");
+    }
+  }
+	
+	.almost-lottery__wrap {
+    position: relative;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+	}
+
+  .almost-lottery__canvas {
+    position: absolute;
+    left: -9999px;
+    opacity: 0;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+  }
+
+  .almost-lottery__action {
+    position: absolute;
+    background-repeat: no-repeat;
+    background-position: center center;
+    background-size: contain;
+    background-image: url($actionBgUrl + ".png");
+
+    @media (-webkit-min-device-pixel-ratio: 2), (min-device-pixel-ratio: 2) {
+      background-image: url($actionBgUrl + "2x.png");
+    }
+
+    @media (-webkit-min-device-pixel-ratio: 3), (min-device-pixel-ratio: 3) {
+      background-image: url($actionBgUrl + "3x.png");
+    }
+  }
+
+  .almost-lottery__measureText {
+    position: absolute;
+    left: 0;
+    top: 0;
+    white-space: nowrap;
+    font-size: 12px;
+    opacity: 0;
+  }
+
+  .canvas-img {
+		display: block;
+    transition: transform cubic-bezier(.34, .12, .05, .95);
+  }
+</style>

+ 2 - 2
components/uni-cart-fix/uni-cart-fix.vue

@@ -39,11 +39,11 @@
 					let _this = this
 					if(_this.closeCurPage){
 						uni.redirectTo({
-							url:"/pages/cart/cart"
+							url:"/pagesA/cart/cart"
 						})
 					}else{
 						uni.navigateTo({
-							url:"/pages/cart/cart"
+							url:"/pagesA/cart/cart"
 						})
 					}
 				},

+ 1 - 1
components/uni-coods/uni-coods.vue

@@ -107,7 +107,7 @@
 			// 商品详情
 			toDetail(item){
 				uni.navigateTo({
-					url:"/pages/goods/goodsDetail?id="+item.id + "&goldLimit="+this.goldLimit
+					url:"/pagesA/goods/goodsDetail?id="+item.id + "&goldLimit="+this.goldLimit
 				})
 			}
 		},

+ 120 - 74
pages.json

@@ -11,16 +11,16 @@
 			}
 		},
 		{
-			"path": "pages/login/login",
+			"path": "pages/goods/index", // 商城
 			"style": {
-				"navigationBarTitleText": "授权登录"
+				"navigationBarTitleText": "乐色商城",
+				"enablePullDownRefresh": true
 			}
 		},
 		{
-			"path": "pages/goods/index", // 商城
+			"path": "pages/login/login",
 			"style": {
-				"navigationBarTitleText": "乐色商城",
-				"enablePullDownRefresh": true
+				"navigationBarTitleText": "授权登录"
 			}
 		},
 		{
@@ -97,72 +97,13 @@
 				"navigationBarTitleText": "回收分类"
 			}
 		},
-		{
-			"path": "pages/order/order",
-			"style": {
-				"navigationBarTitleText": "我的订单",
-				"enablePullDownRefresh": true
-			}
-		}, {
-			"path": "pages/order/orderDetail",
-			"style": {
-				"navigationBarTitleText": "订单详情"
-			}
-		}, 
-		{
-			"path": "pages/order/LogList",
-			"style": {
-				"navigationBarTitleText": "物流信息"
-			}
-		}, 
 		{
 			"path": "pages/agreement/agreement",
 			"style": {
 				"navigationBarTitleText": "注意事项及服务协议"
 			}
-		}
-        ,{
-            "path" : "pages/cart/cart",
-            "style" :                                                                                    
-            {
-                "navigationBarTitleText": "购物车",
-                "enablePullDownRefresh": false
-            }
-        }
-		,{
-		    "path" : "pages/toOrder/index",
-		    "style" :                                                                                    
-		    {
-		        "navigationBarTitleText": "提交订单",
-		        "enablePullDownRefresh": false
-		    }
-		}
-		,{
-		    "path" : "pages/toOrder/editAddress",
-		    "style" :                                                                                    
-		    {
-		        "navigationBarTitleText": "修改地址",
-		        "enablePullDownRefresh": false
-		    }
-		}
-        ,{
-            "path" : "pages/goods/goods",
-            "style" :                                                                                    
-            {
-                "navigationBarTitleText": "商品",
-                "enablePullDownRefresh": true
-            }
-            
-        },
+		},
 		{
-            "path" : "pages/goods/goodsDetail",
-            "style" :                                                                                    
-            {
-                "navigationBarTitleText": "商品详情",
-                "enablePullDownRefresh": false
-            }
-        }
-        ,{
             "path" : "pages/store/store",
             "style" :                                                                                    
             {
@@ -179,15 +120,6 @@
 		        "enablePullDownRefresh": false
 		    }
 		    
-		},
-		{
-		    "path" : "pages/toOrder/payFinish",
-		    "style" :                                                                                    
-		    {
-		        "navigationBarTitleText": "支付完成",
-		        "enablePullDownRefresh": false
-		    }
-		    
 		},
 		{
 		    "path" : "pages/checkOut/checkFinish",
@@ -208,6 +140,120 @@
             
         }
     ],
+	"subPackages": [{
+		"root": "pagesA",
+		"pages": [
+			{
+			    "path" : "cart/cart",
+			    "style" :                                                                                    
+			    {
+			        "navigationBarTitleText": "购物车",
+			        "enablePullDownRefresh": false
+			    }
+			},
+			{
+				"path": "order/order",
+				"style": {
+					"navigationBarTitleText": "我的订单",
+					"enablePullDownRefresh": true
+				}
+			}, {
+				"path": "order/orderDetail",
+				"style": {
+					"navigationBarTitleText": "订单详情"
+				}
+			}, 
+			{
+				"path": "order/LogList",
+				"style": {
+					"navigationBarTitleText": "物流信息"
+				}
+			}, 
+			{
+			    "path" : "toOrder/index",
+			    "style" :                                                                                    
+			    {
+			        "navigationBarTitleText": "提交订单",
+			        "enablePullDownRefresh": false
+			    }
+			}
+			,{
+			    "path" : "toOrder/editAddress",
+			    "style" :                                                                                    
+			    {
+			        "navigationBarTitleText": "修改地址",
+			        "enablePullDownRefresh": false
+			    }
+			},
+			{
+			    "path" : "toOrder/payFinish",
+			    "style" :                                                                                    
+			    {
+			        "navigationBarTitleText": "支付完成",
+			        "enablePullDownRefresh": false
+			    }
+			    
+			},
+			{
+			    "path" : "luckDraw/luckDraw",
+			    "style" :                                                                                    
+			    {
+			        "navigationBarTitleText": "幸运大转盘",
+			        "enablePullDownRefresh": false
+			    }
+			    
+			},
+			{
+			    "path" : "luckDraw/paySuccess",
+			    "style" :                                                                                    
+			    {
+			        "navigationBarTitleText": "支付完成",
+			        "enablePullDownRefresh": false
+			    }
+			    
+			},
+			{
+			    "path" : "luckDraw/myJp",
+			    "style" :                                                                                    
+			    {
+			        "navigationBarTitleText": "我的奖品",
+			        "enablePullDownRefresh": false
+			    }
+			    
+			}
+		    ,{
+                    "path" : "taskList/taskList",
+                    "style" :                                                                                    
+                {
+                    "navigationBarTitleText": "抽奖任务",
+                    "enablePullDownRefresh": false
+                }
+            },
+			{
+				"path" : "goods/goods",
+				"style" :                                                                                    
+				{
+					"navigationBarTitleText": "商品",
+					"enablePullDownRefresh": true
+				}
+				
+			},
+			{
+				"path" : "goods/goodsDetail",
+				"style" :                                                                                    
+				{
+					"navigationBarTitleText": "商品详情",
+					"enablePullDownRefresh": false
+				}
+			}
+            ]
+	}],
+	"preloadRule": {
+		"pages/index/index": {
+			"network": "all",
+			"packages": ["pagesA"]
+		}
+	},
 	"globalStyle": {
 		"navigationBarTextStyle": "black",
 		"navigationBarTitleText": "uni-app",

+ 5 - 0
pages/agreement/agreement.vue

@@ -167,6 +167,11 @@
 			uni.setNavigationBarTitle({
 				title: "服务协议"
 			})
+			// 开启分享
+			uni.showShareMenu({
+				withShareTicket: true,
+				menus: ['shareAppMessage', 'shareTimeline']
+			})
 		},
 		methods: {
 		}

+ 5 - 0
pages/checkOut/checkFinish.vue

@@ -30,6 +30,11 @@ export default {
 	onLoad(option) {
 		console.log(option,'option')
 		this.payNum = option.num
+		// 开启分享
+		uni.showShareMenu({
+			withShareTicket: true,
+			menus: ['shareAppMessage', 'shareTimeline']
+		})
 	},
 	methods: {
 		// 返回首页

+ 5 - 0
pages/checkOut/checkOut.vue

@@ -106,6 +106,11 @@
 			this.store = JSON.parse(decodeURIComponent(opts.store))
 			this.partnerNo = this.store.officialPartnerNo
 			// console.log(this.store,'22222')
+			// 开启分享
+			uni.showShareMenu({
+				withShareTicket: true,
+				menus: ['shareAppMessage', 'shareTimeline']
+			})
 		},
 		methods: {
 			// 跳转到设置支付密码页

+ 6 - 1
pages/goods/index.vue

@@ -44,6 +44,11 @@
 		},
 		onLoad() {
 			this.pageInit()
+			// 开启分享
+			uni.showShareMenu({
+				withShareTicket: true,
+				menus: ['shareAppMessage', 'shareTimeline']
+			})
 		},
 		computed: {
 			goodsListLength() {
@@ -134,7 +139,7 @@
 			// 更多商品
 			toGoods(item){
 				uni.navigateTo({
-					url:"/pages/goods/goods?goodsTypeNo="+ item.goodsTypeNo + "&goldLimit="+ item.goldLimit + "&name=" + item.name
+					url:"/pagesA/goods/goods?goodsTypeNo="+ item.goodsTypeNo + "&goldLimit="+ item.goldLimit + "&name=" + item.name
 				})
 			},
 		}

+ 122 - 6
pages/index/index.vue

@@ -37,7 +37,7 @@
 			 				<view>{{ item.provinceName||'' }}{{ item.cityName||'' }}{{ item.districtName||'' }}{{ item.address||'' }}</view>
 			 				<view>
 			 					<u-icon name="map-fill" color="#01c9b2" size="30"></u-icon>
-			 					{{ item.distanct.distance ? (item.distanct.distance / 1000).toFixed(1) : 0 }}KM
+			 					{{ getDistanct(item) }}KM
 			 					<u-icon name="arrow-right" color="#999" size="20"></u-icon>
 			 				</view>
 			 			</view>
@@ -59,6 +59,23 @@
 				</view>
 			 </view>
 		</view>
+		<!-- 转盘浮动图片 -->
+		<view class="luckwheel-fixed" v-if="showFixedLottery" @click="toLuckDraw()">
+			<u-image width="140rpx" height="140rpx" src="/static/luckwheel-fixed1.gif"></u-image>
+		</view>
+		<!-- 抽奖活动弹框 -->
+		<u-mask :show="showLottery" @click="showLottery = false">
+			<view class="lottery-content">
+				<view>
+					<view class="bg">
+						<u-image src="/static/toLottery.png" width="495rpx" height="466rpx" @click="toLuckDraw"></u-image>
+					</view>
+					<view class="close-btn" @click="showLottery = false">
+						<u-image src="/static/closeLottery.png" width="54rpx" height="163rpx"></u-image>
+					</view>
+				</view>
+			</view>
+		</u-mask>
 	</view>
 </template>
 
@@ -69,19 +86,24 @@
 		deleteGoodsFormCart,
 		updateGoodsBuyQty
 	} from '@/api/shoppingCart.js'
+	import {findEnable,findCustomerTimes} from '@/api/luckyDraw.js'
 	import {bannerList} from '@/api/banner.js'
 	import {getLookUpDatas,openDevice} from '@/api/data.js'
 	import {stationList} from '@/api/station.js'
 	import {checkLogin,getUserInfo} from '@/api/login.js'
 	import {parseQueryString} from '@/libs/tools.js'
-	import { sellerFindByPartnerNo } from '@/api/user.js'
+	import {sellerFindByPartnerNo} from '@/api/user.js'
+	import moment from 'moment'
 	export default {
 		data() {
 			return {
 				imageTopList: [],
 				stationDataList: [] ,//  附近网点列表
 				hasLogin: false,
-				userData: null
+				userData: null,
+				showLottery: false, // 是否显示抽奖弹框
+				showFixedLottery: false,
+				hasShowHd: false
 			}
 		},
 		onLoad() {
@@ -101,6 +123,11 @@
 			uni.$on("getUserInfo",item=>{
 				this.getUserInfo(item)
 			})
+			// 开启分享
+			uni.showShareMenu({
+				withShareTicket: true,
+				menus: ['shareAppMessage', 'shareTimeline']
+			})
 		},
 		onUnload() {
 			console.log('onUnload')
@@ -108,7 +135,15 @@
 			uni.$off('getCartList')
 			uni.$off('getUserInfo')
 		},
+		onShareAppMessage(res) {
+			console.log(res)
+		},
+		onShareTimeline(res) {
+			console.log(res)
+		},
 		onShow() {
+			// 判断是否有抽奖活动
+			this.getLuckDraw()
 			// 获取订单状态数据字典
 			// this.getCodeList('RUBBISH_TYPE','vuex_rubbishType')
 			// 获取顶部轮播图
@@ -149,6 +184,41 @@
 				  // 新的版本下载失败
 				});
 			},
+			// 计算距离
+			getDistanct(item){
+				return item.distanct&&item.distanct.distance ? (item.distanct.distance / 1000).toFixed(1) : 0
+			},
+			// 抽奖弹框
+			getLuckDraw(){
+				findEnable().then(res => {
+					if(res.status == 200 && res.data){
+						this.$u.vuex('vuex_LuckDraw',res.data)
+						// 判断活动是否过期
+						let a = moment().isBetween(res.data.activeStartTime,res.data.activeEndTime,'days','[]')
+						if(a){
+							this.showFixedLottery = true
+							// 判断是否有免费抽奖次数
+							findCustomerTimes({id:res.data.luckyDrawNo}).then(res => {
+								let reTimes = 0
+								if(res.status == 200){
+									reTimes = res.data.timesSurplus || 0
+								}
+								this.$u.vuex('vuex_LuckDrawTimes',reTimes)
+								if(!this.hasShowHd){
+									this.showLottery = reTimes > 0
+									this.hasShowHd = true
+								}
+							})
+						}else{
+							this.showFixedLottery = false
+						}
+					}else{
+						this.showFixedLottery = false
+						this.showLottery = false
+						this.$u.vuex('vuex_LuckDraw',null)
+					}
+				})
+			},
 			// 获取用户信息
 			getUserInfo(){
 				getUserInfo().then(res => {
@@ -205,9 +275,23 @@
 				let row = this.imageTopList[index]
 				console.log(index,row)
 				if(row.jumpType !== 'NONE'){
-					uni.navigateTo({
-						url: row.jumpUrl
-					})
+					// 如果是大转盘
+					if(row.jumpUrl.indexOf('pagesA/luckDraw') >= 0){
+						if(this.showFixedLottery){
+							uni.navigateTo({
+								url:row.jumpUrl
+							})
+						}else{
+							uni.showToast({
+								icon: 'none',
+								title: '活动已结束'
+							})
+						}
+					}else{
+						uni.navigateTo({
+							url: row.jumpUrl
+						})
+					}
 				}
 			},
 			// 查询购物车
@@ -336,6 +420,12 @@
 				uni.navigateTo({
 					url: '/pages/store/store?id=' + item.id + '&stationNo=' + item.stationNo
 				})
+			},
+			// 去抽奖
+			toLuckDraw(){
+				uni.navigateTo({
+					url: '/pagesA/luckDraw/luckDraw'
+				})
 			}
 		}
 	}
@@ -355,6 +445,32 @@
 				padding-top: 10upx;
 			}
 		}
+		.luckwheel-fixed{
+			position: fixed;
+			right: 20rpx;
+			bottom: 20%;
+		}
+		.lottery-content{
+			display: flex;
+			align-items: center;
+			justify-content: center;
+			height: 100%;
+			> view{
+				width: 495rpx;
+				height: 466rpx;
+				position: relative;
+				.close-btn{
+				 position: absolute;
+				 right: 32rpx;
+				 top: 0 ;
+				}
+				.bg{
+					position: absolute;
+					left: 0;
+					top: 0 ;
+				}
+			}
+		}
 		.storeList {
 			padding: 25upx 0 20upx;
 			.store-section {

+ 7 - 2
pages/login/login.vue

@@ -34,7 +34,7 @@
 		data() {
 			return {
 				path: '/pages/index/index',
-				lanuch: true,
+				lanuch: false,
 				code: '',
 				wxButton: {
 					background: '#07c160'
@@ -46,6 +46,11 @@
 		},
 		mounted() {},
 		onLoad(option) {
+			// 开启分享
+			uni.showShareMenu({
+				withShareTicket: true,
+				menus: ['shareAppMessage', 'shareTimeline']
+			})
 			// 为解决首次登录异常问题 进入页面先调微信登录获取code
 			this.wxLogin()
 			const {
@@ -133,7 +138,7 @@
 			// 手机号登录
 			phoneLogin () {
 			  wx.navigateTo({
-			    url: '/pages/login/phoneLogin'
+			    url: '/pages/login/phoneLogin?path='+this.path+'&lanuch='+this.lanuch
 			  })
 			}
 		}

+ 22 - 4
pages/login/phoneLogin.vue

@@ -47,10 +47,22 @@
 				popBtn: [],  //  name为操作按钮名称,color为操作按钮颜色值
 				changeImg: false,  //  是否重新更换图形验证码
 				randomCode: '',  //  图片验证码随机码
-				wxcode: ''
+				wxcode: '',
+				path: '/pages/index/index',
+				lanuch: false,
 			}
 		},
 		onLoad(opts) {
+			// 开启分享
+			uni.showShareMenu({
+				withShareTicket: true,
+				menus: ['shareAppMessage', 'shareTimeline']
+			})
+			const {
+				path,
+				lanuch
+			} = option;
+			this.lanuch = (lanuch + '') === 'true';
 		},
 		onUnload() {
 			uni.$off('getUserInfo')
@@ -90,9 +102,15 @@
 							getApp().globalData.token = res.data
 							_this.$u.vuex('vuex_token',res.data)
 							uni.$emit("getUserInfo")
-						    uni.navigateBack({
-						    	delta: 2
-						    })
+						    if (_this.path === '/pages/index/index' || _this.lanuch) {
+						    	uni.reLaunch({
+						    		url: _this.path
+						    	});
+						    } else {
+						    	uni.redirectTo({
+						    		url: _this.path
+						    	});
+						    }
 						  }else{
 							  uni.showToast({icon: 'none',title: res.message})
 						  }

+ 5 - 0
pages/store/store.vue

@@ -74,6 +74,11 @@
 			this.stationNo = options.stationNo
 			this.getStation()  //  网点信息
 			this.getDevice()  //  设备信息
+			// 开启分享
+			uni.showShareMenu({
+				withShareTicket: true,
+				menus: ['shareAppMessage', 'shareTimeline']
+			})
 		},
 		methods: {
 			//  网点信息

+ 9 - 0
pages/userCenter/aboutUs.vue

@@ -12,6 +12,15 @@
 </template>
 
 <script>
+	export default {
+		onLoad() {
+			// 开启分享
+			uni.showShareMenu({
+				withShareTicket: true,
+				menus: ['shareAppMessage', 'shareTimeline']
+			})
+		},
+	}
 </script>
 
 <style lang="less">

+ 7 - 0
pages/userCenter/deliveryRecord.vue

@@ -46,6 +46,13 @@
 				status: 'loadmore',  //  加载中状态
 			}
 		},
+		onLoad() {
+			// 开启分享
+			uni.showShareMenu({
+				withShareTicket: true,
+				menus: ['shareAppMessage', 'shareTimeline']
+			})
+		},
 		onShow() {
 			this.searchHandle(1)
 		},

+ 18 - 13
pages/userCenter/fenlei.vue

@@ -1,18 +1,13 @@
 <template>
 	<view class="zn-container">
-		<u-image width="750rpx" height="2722rpx" src="https://chelingzhu.oss-cn-beijing.aliyuncs.com/dev/2020/11/10/9a11b2813f3548a19b77d97c1cb0ae8c.jpg"></u-image>
-		<u-image width="750rpx" height="1117rpx" src="https://chelingzhu.oss-cn-beijing.aliyuncs.com/dev/2020/11/10/8c40db43da34483ba1493daa584e2ff3.jpg"></u-image>
-		<u-image width="750rpx" height="2423" src="https://chelingzhu.oss-cn-beijing.aliyuncs.com/dev/2020/11/10/da88fdfe54384906a4ba0491dcbfb376.jpg"></u-image>
-		<u-image width="750rpx" height="4259" src="https://chelingzhu.oss-cn-beijing.aliyuncs.com/dev/2020/11/10/77e0d574d1ef496ba1e5cc72acf927f7.jpg"></u-image>
-		<u-image width="750rpx" height="2824" src="https://chelingzhu.oss-cn-beijing.aliyuncs.com/dev/2020/11/10/8964ef3f71534ef0b8f9568dedd5ce14.jpg"></u-image>
-		<u-image width="750rpx" height="2526" src="https://chelingzhu.oss-cn-beijing.aliyuncs.com/dev/2020/11/10/1be83306886a47ebaf2d1bd2ac23ea59.jpg"></u-image>
-		<u-image width="750rpx" height="4336" src="https://chelingzhu.oss-cn-beijing.aliyuncs.com/dev/2020/11/10/dc07c79759374f45a2b7e180ea837d20.jpg"></u-image>
-		<u-image width="750rpx" height="3591" src="https://chelingzhu.oss-cn-beijing.aliyuncs.com/dev/2020/11/10/bdd2c38634ad434c8e776870328fe1e1.jpg"></u-image>
-		<u-image width="750rpx" height="4698" src="https://chelingzhu.oss-cn-beijing.aliyuncs.com/dev/2020/11/10/099d4966e7d8437b84f464e60bc2f375.jpg"></u-image>
-		<u-image width="750rpx" height="2211" src="https://chelingzhu.oss-cn-beijing.aliyuncs.com/dev/2020/11/10/6327e833ff514966b4a365b9fb40ffb5.jpg"></u-image>
-		<u-image width="750rpx" height="1116" src="https://chelingzhu.oss-cn-beijing.aliyuncs.com/dev/2020/11/10/1cc4cc47dfdb4d40ac78b997c49f8912.jpg"></u-image>
-		<u-image width="750rpx" height="2841" src="https://chelingzhu.oss-cn-beijing.aliyuncs.com/dev/2020/11/10/4f896f1078af4f998679bf08a06e5df3.jpg"></u-image>
-		<u-image width="750rpx" height="1884" src="https://chelingzhu.oss-cn-beijing.aliyuncs.com/dev/2020/11/10/58c40a9d9101419fafc4d6a347622ea7.jpg"></u-image>
+		<view>
+      <u-image width="750rpx" height="1988rpx" src="https://lese.sxzxyj.net/img/2020/11/28/4cbe4bf9213a4a5c8d658e4903ec30e0.jpg"></u-image>
+      <u-image width="750rpx" height="2211rpx" src="https://lese.sxzxyj.net/img/2020/11/28/83daa070fe8f4bb9a8c583cd05bfa17b.jpg"></u-image>
+      <u-image width="750rpx" height="2219rpx" src="https://lese.sxzxyj.net/img/2020/11/28/da1d20d4003f4d8e8b0d836d0e4dfbed.jpg"></u-image>
+      <u-image width="750rpx" height="2277rpx" src="https://lese.sxzxyj.net/img/2020/11/28/50723317eb0b43908019709ac183ad6a.jpg"></u-image>
+      <u-image width="750rpx" height="1905rpx" src="https://lese.sxzxyj.net/img/2020/11/28/c0acd89eb40a4050a7af8ac4f8855489.jpg"></u-image>
+      <u-image width="750rpx" height="1958rpx" src="https://lese.sxzxyj.net/img/2020/11/28/df135dea14014a25b93d5ae0bb260beb.jpg"></u-image>
+    </view>
 	</view>
 </template>
 
@@ -24,6 +19,11 @@
 			}
 		},
 		onLoad() {
+			// 开启分享
+			uni.showShareMenu({
+				withShareTicket: true,
+				menus: ['shareAppMessage', 'shareTimeline']
+			})
 		}
 	}
 </script>
@@ -31,5 +31,10 @@
 <style lang="less">
 	.zn-container{
 		width: 100%;
+    background-color: #FFFFFF;
+    > view{
+      width: 100%;
+      margin: 0 auto;
+    }
 	}
 </style>

+ 11 - 4
pages/userCenter/index.vue

@@ -27,8 +27,9 @@
 		<view class="user-list">
 			<u-cell-group>
 				<u-cell-item v-if="hasLogin" icon="order" icon-size="38" :icon-style="{color:'#ff5500'}" index="0" @click="toPage" title="我的订单"></u-cell-item>
-				<u-cell-item v-if="hasLogin" icon="gift" icon-size="40" :icon-style="{color:'#00aaff'}" index="1" @click="toPage" title="投递记录"></u-cell-item>
-				<u-cell-item icon="question-circle" icon-size="40" :icon-style="{color:'#19be6b'}" index="2" @click="toPage" title="常见问题"></u-cell-item>
+				<u-cell-item v-if="hasLogin" icon="gift" icon-size="40" :icon-style="{color:'#aa55ff'}" index="5" @click="toPage" title="我的奖品"></u-cell-item>
+				<u-cell-item v-if="hasLogin" icon="list-dot" icon-size="36" :icon-style="{color:'#00aaff'}" index="1" @click="toPage" title="投递记录"></u-cell-item>
+				<u-cell-item icon="question-circle" icon-size="39" :icon-style="{color:'#19be6b'}" index="2" @click="toPage" title="常见问题"></u-cell-item>
 				<u-cell-item icon="phone" icon-size="40" :icon-style="{color:'#f00'}" @click="callPhone" title="联系客服"></u-cell-item>
 				<u-cell-item icon="file-text" icon-size="40" :icon-style="{color:'#ffaa00'}" index="3" @click="toPage" title="服务协议"></u-cell-item>
 				<u-cell-item icon="info-circle" icon-size="38" :icon-style="{color:'#55aa00'}" index="4" @click="toPage" title="关于我们"></u-cell-item>
@@ -64,6 +65,11 @@
 			}
 		},
 		onLoad() {
+			// 开启分享
+			uni.showShareMenu({
+				withShareTicket: true,
+				menus: ['shareAppMessage', 'shareTimeline']
+			})
 		},
 		methods:{
 			// 获取用户信息
@@ -80,11 +86,12 @@
 			toPage(index){
 				console.log(index)
 				let pageUrl=[
-					'/pages/order/order',
+					'/pagesA/order/order',
 					'/pages/userCenter/deliveryRecord',
 					'/pages/userCenter/question',
 					'/pages/agreement/agreement?fromPage=usercenter',
-					'/pages/userCenter/aboutUs'
+					'/pages/userCenter/aboutUs',
+					'/pagesA/luckDraw/myJp?fromPage=usercenter'
 					]
 				uni.navigateTo({
 					url: pageUrl[index]

+ 5 - 0
pages/userCenter/ldDetailed.vue

@@ -69,6 +69,11 @@
 		onLoad() {
 			this.timeScope = 'threeMonth'
 			this.queryParam.changeType = ''
+			// 开启分享
+			uni.showShareMenu({
+				withShareTicket: true,
+				menus: ['shareAppMessage', 'shareTimeline']
+			})
 		},
 		computed: {
 			// 时间过滤条件

+ 5 - 0
pages/userCenter/myCode/myCode.vue

@@ -19,6 +19,11 @@
 		},
 		onLoad() {
 			this.creatQrCode()
+			// 开启分享
+			uni.showShareMenu({
+				withShareTicket: true,
+				menus: ['shareAppMessage', 'shareTimeline']
+			})
 		},
 		methods: {
 			creatQrCode() {

+ 9 - 0
pages/userCenter/question.vue

@@ -24,6 +24,15 @@
 </template>
 
 <script>
+	export default {
+		onLoad() {
+			// 开启分享
+			uni.showShareMenu({
+				withShareTicket: true,
+				menus: ['shareAppMessage', 'shareTimeline']
+			})
+		},
+	}
 </script>
 
 <style lang="scss">

+ 8 - 1
pages/userCenter/userInfo/userInfo.vue

@@ -33,6 +33,13 @@
 				userInfo: {}
 			}
 		},
+		onLoad() {
+			// 开启分享
+			uni.showShareMenu({
+				withShareTicket: true,
+				menus: ['shareAppMessage', 'shareTimeline']
+			})
+		},
 		onShow() {
 			this.userDate = this.$store.state.vuex_userData
 			this.getPayPwd()
@@ -68,7 +75,7 @@
 			editAddress(index){
 				this.$u.vuex("vuex_OrderAddress",this.userInfo)
 				uni.navigateTo({
-					url:"/pages/toOrder/editAddress"
+					url:"/pagesA/toOrder/editAddress"
 				})
 			},
 			// 设置密码

+ 9 - 0
pages/userCenter/zhinan.vue

@@ -121,6 +121,15 @@
 </template>
 
 <script>
+	export default {
+		onLoad() {
+			// 开启分享
+			uni.showShareMenu({
+				withShareTicket: true,
+				menus: ['shareAppMessage', 'shareTimeline']
+			})
+		},
+	}
 </script>
 
 <style lang="scss">

+ 6 - 1
pages/cart/cart.vue → pagesA/cart/cart.vue

@@ -183,6 +183,11 @@
 			// 获取购物车数据
 			this.loading = true
 			this.getCartList()
+			// 开启分享
+			uni.showShareMenu({
+				withShareTicket: true,
+				menus: ['shareAppMessage', 'shareTimeline']
+			})
 		},
 		methods: {
 			// 计算购物车数量
@@ -350,7 +355,7 @@
 						if(a.length==0){
 							this.$u.vuex("vuex_toOrderList",goods)
 							uni.redirectTo({
-								url:"/pages/toOrder/index?orderForm=SHOPPING_CAR"
+								url:"/pagesA/toOrder/index?orderForm=SHOPPING_CAR"
 							})
 						}else{
 							this.showMsg = true

+ 5 - 0
pages/goods/goods.vue → pagesA/goods/goods.vue

@@ -36,6 +36,11 @@
 				title: this.goodsName
 			})
 			this.getGoods()
+			// 开启分享
+			uni.showShareMenu({
+				withShareTicket: true,
+				menus: ['shareAppMessage', 'shareTimeline']
+			})
 		},
 		// 下拉刷新
 		onPullDownRefresh() {

+ 7 - 2
pages/goods/goodsDetail.vue → pagesA/goods/goodsDetail.vue

@@ -2,7 +2,7 @@
 	<view class="goods-detail">
 		<view>
 			<!-- 商品信息 -->
-			<view class="goods-head">
+			<view class="goods-head" v-if="goodContent">
 				<view class="goods-imgs">
 					<view class="goods-staus" v-if="goodContent.inventoryQty == 0 || goodContent.delFlage == 0 || goodContent.state == 0"></view>
 					<u-swiper height="325" :border-radius="15" mode="number" indicator-pos="bottomRight" :list="imageList"></u-swiper>
@@ -91,6 +91,11 @@
 			this.id = opts.id
 			this.userData = this.$store.state.vuex_userData
 			this.getDetail()
+			// 开启分享
+			uni.showShareMenu({
+				withShareTicket: true,
+				menus: ['shareAppMessage', 'shareTimeline']
+			})
 		},
 		methods: {
 			// 查详情
@@ -152,7 +157,7 @@
 					if(this.goodContent.sellGold * this.nums >= this.goldLimit){
 						this.$u.vuex("vuex_toOrderList",[{id:this.id,buyQty:this.nums,goodsNo:this.goodContent.goodsNo,goods:this.goodContent}])
 						uni.redirectTo({
-							url:"/pages/toOrder/index?orderForm=ORDER_NOW"
+							url:"/pagesA/toOrder/index?orderForm=ORDER_NOW"
 						})
 					}else{
 						uni.showToast({

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 642 - 0
pagesA/luckDraw/luckDraw.vue


+ 407 - 0
pagesA/luckDraw/myJp.vue

@@ -0,0 +1,407 @@
+<template>
+	<view class="page-cont">
+		<view class="list" v-for="(item,index) in list" :key="item.id">
+			<view class="no">奖品{{index+1}}</view>
+			<view class="names">{{item.prizeType == 'GOODS'?item.prizeDesc:(item.prizeDesc+'乐豆')}}</view>
+			<view class="lingjiang" v-if="item.state == 'WAIT_RECEIVE'" @click="lingjiang(item)">领奖</view>
+			<view class="viewsDetail" v-else @click="viewsDetail(item)">查看详情</view>
+		</view>
+		<view style="padding:150rpx 30rpx 0;" v-if="list.length == 0">
+			<u-empty text="还没有奖品记录" :icon-size="80" mode="list"></u-empty>
+			<!-- <view style="text-align: center;">
+				<u-button size="mini" @click="goBack">去抽奖</u-button>
+			</view> -->
+		</view>
+		
+		<!-- 查看详情弹框 -->
+		<u-popup v-model="showViews" mode="center" close-icon-color="#ffffff" closeable :border-radius="30" width="500rpx">
+			<view class="lottery-content">
+				<view class="lottery-title">物流信息</view>
+				<view class="lottery-form">
+					<view>
+						<view class="labes">收件人</view>
+						<view>{{curRevice.receiverName}}</view>
+					</view>
+					<view>
+						<view class="labes">联系电话</view>
+						<view>{{curRevice.receiverPhone}}</view>
+					</view>
+					<view>
+						<view class="labes">收货地址</view>
+						<view style="word-break: break-all;">{{curRevice.receiveAddress}}</view>
+					</view>
+					<view>
+						<view class="labes">物流单号</view>
+						<view>
+							<view v-if="curRevice.state == 'WAIT_SEND_EXPRESS'">暂未发货,如收货信息有误, 请联系客服电话<text class="tell" @click="callPhone">{{kfPhone}}</text></view>
+							<view v-else>
+								{{curRevice.expressName}} <text class="tell">(单号:{{curRevice.expressNum}})</text> <u-button @click="copyWlCode" size="mini">复制</u-button>
+							</view>
+						</view>
+					</view>
+				</view>
+				<view @click="showViews=false" class="lottery-confrim-btn">
+					确定
+				</view>
+			</view>
+		</u-popup>
+		
+		<!-- 乐豆领取详情弹框 -->
+		<u-popup v-model="showLjLd" mode="center" close-icon-color="#ffffff" closeable :border-radius="30" width="500rpx">
+			<view class="lottery-content">
+				<view class="lottery-title">欢迎领取</view>
+				<view class="lottery-msg">
+					您的奖励已计入乐豆余额,感谢参与!
+				</view>
+				<view @click="showLjLd=false" class="lottery-confrim-btn">
+					我知道了
+				</view>
+			</view>
+		</u-popup>
+		
+		<!-- 收货地址详情弹框 -->
+		<u-popup v-model="showAddr" mode="center" close-icon-color="#ffffff" closeable :border-radius="30" width="80%">
+			<view class="lottery-content">
+				<view class="lottery-title">收货信息</view>
+				<view class="lottery-u-form">
+					 <u-form :model="form" ref="uForm" :label-width="140" :error-type="['toast']">
+					 	<u-form-item label="收货人" required prop="receiverName">
+					 		<u-input placeholder="请输入收货人姓名" :maxlength="30" v-model="form.receiverName" />
+					 	</u-form-item>
+					 	<u-form-item label="收货电话" required prop="receiverPhone">
+					 		<u-input placeholder="请输入收货电话" :maxlength="11" type="number" v-model="form.receiverPhone" />
+					 	</u-form-item>
+					 	<u-form-item label="省市区" required prop="receiveAreasName">
+					 		<u-input v-model="areaInfo.label" placeholder="请选择省市区" @click="openAddress" type="select" />
+					 		<Address ref="applyAddress" @onConfirm="areaConfirm"></Address>
+					 	</u-form-item>
+					 	<u-form-item label="详细地址" :border-bottom="false" required prop="receiveAddress">
+					 		<u-input type="textarea" :height="100" auto-height placeholder="请输入收货详细地址(最多100个字符)" :maxlength="100" v-model="form.receiveAddress" class="receiveAddress"/>
+					 	</u-form-item>
+					 </u-form>
+				</view>
+				<view @click="wlSubmit" class="lottery-confrim-btn">
+					确定
+				</view>
+			</view>
+		</u-popup>
+		
+	</view>
+</template>
+
+<script>
+import Address from '@/components/address.vue'
+import {findAddressBycustomerNo, saveAddress} from '@/api/receiveAddress.js'
+import { findWinPrize, receive } from '@/api/luckyDraw.js'
+export default {
+	components: {
+		Address
+	},
+	data() {
+		return {
+			kfPhone:'', // 客服电话
+			showViews: false, // 查看详情弹框
+			showAddr: false ,// 实物奖品,收货地址弹框
+			showLjLd: false, // 虚拟奖品领奖弹框
+			form: {
+				receiverName: '',
+				receiverPhone: '',
+				receiveAddress: '' // 详细地址
+			},
+			receiveAreas: '', //地址编码
+			areaName: '', //地址
+			areaInfo: {},  //  省市区
+			areaIdArr: [],  //  省市区id数组
+			list: [],
+			curRevice: null,
+			fromPage: ''
+		}
+	},
+	// 必须要在onReady生命周期,因为onLoad生命周期组件可能尚未创建完毕
+	onReady() {
+		this.$refs.uForm.setRules(this.rules);
+	},
+	onLoad(option) {
+		console.log(option,'option')
+		this.getfindWinPrize()
+		this.kfPhone = this.$store.state.vuex_kfMobile
+		this.fromPage = option.fromPage
+		// 开启分享
+		uni.showShareMenu({
+			withShareTicket: true,
+			menus: ['shareAppMessage', 'shareTimeline']
+		})
+	},
+	onUnload() {
+		this.form = {
+			receiverName: '',
+			receiverPhone: '',
+			receiveAddress: '' // 详细地址
+		}
+	},
+	methods: {
+		goBack(){
+			if(this.fromPage == 'usercenter'){
+				uni.redirectTo({
+					url: '/pagesA/luckDraw/luckDraw'
+				})
+			}else{
+				uni.navigateBack()
+			}
+		},
+		// 电话客服
+		callPhone () {
+			uni.makePhoneCall({
+			    phoneNumber: this.kfPhone
+			})
+		},
+		getfindWinPrize(){
+			uni.showLoading({
+				mask: true,
+				title: '正在加载...'
+			})
+			findWinPrize().then(res => {
+				if(res.status == 200){
+					this.list = res.data
+				}
+				uni.hideLoading()
+			})
+		},
+		// 获取用户收货地址
+		getAddress() {
+			 findAddressBycustomerNo({}).then(res => {
+				 console.log(res)
+				 if (res.status == 200&&res.data.length) {
+					 this.form = res.data[0]
+					 if (this.form.receiveAreasName) {
+						 this.areaIdArr = this.form.receiveAreas.split(',')
+						 this.areaInfo.label = this.form.receiveAreasName.replace(/\,/g,'-')
+					 }
+					 this.$u.vuex("vuex_OrderAddress",this.form)
+				 }
+			 })
+		},
+		//  选择省区市
+		areaConfirm(e) {
+			console.log('已选择的省市区', e)
+			this.areaInfo = e
+			this.areaIdArr = [ e.provinceCode, e.cityCode, e.areaCode ]
+		},
+		openAddress(){
+			//  省市区回显参数为省市区id数组
+			this.$refs.applyAddress.open(this.areaIdArr)
+		},
+		// 去抽奖
+		toLuckDraw() {
+			uni.navigateBack()
+		},
+		// 查看详情
+		viewsDetail(item){
+			this.curRevice = item
+			if(item.prizeType == 'GOODS'){
+				this.showViews = true
+			}else{
+				this.showLjLd = true
+			}
+		},
+		// 领奖
+		lingjiang(item){
+			this.curRevice = item
+			if(item.prizeType == 'GOODS'){
+				this.showAddr = true
+				this.getAddress()
+			}else{
+				this.saveReceive()
+			}
+		},
+		// 复制单号
+		copyWlCode(){
+			uni.setClipboardData({
+			    data: this.curRevice.expressNum,
+			    success: function () {
+			        console.log('success');
+			    }
+			});
+		},
+		// 保存物流信息
+		wlSubmit(){
+			this.$refs.uForm.validate(valid => {
+				if (valid) {
+					console.log('验证通过');
+					if (this.form.receiverName ==='') {
+						uni.showToast({
+							title: '请输入收货人姓名',
+							icon: 'none'
+						})
+						return false
+					}
+					if (this.form.receiverPhone ==='') {
+						uni.showToast({
+							title: '请输入收货电话',
+							icon: 'none'
+						})
+						return false
+					}
+					//  省市区
+					if(this.areaIdArr.length == 0){
+						uni.showToast({icon: 'none',title: '请选择省市区'})
+						return
+					}
+					if (this.form.receiveAddress ==='') {
+						uni.showToast({
+							title: '请输入详细地址',
+							icon: 'none'
+						})
+						return false
+					}
+					let params = {
+						receiverName: this.form.receiverName,
+						receiverPhone: this.form.receiverPhone,
+						receiveAreasName: this.areaInfo.label.replace(/\-/g,','), // 地址名称
+						receiveAreas: this.areaIdArr.join(','), 
+						receiveAddress: this.form.receiveAddress // 详细地址
+					}
+					if(this.form.id) {
+						params.id = this.form.id
+					}
+					// 保存我的收货地址
+					saveAddress(params).then(res=>{
+						if(res.status == 200) {
+							// 保存领奖收货信息
+							this.saveReceive(params)
+						} 
+					})
+				}
+			});
+		},
+		// 领奖
+		saveReceive(params){
+			let item = this.curRevice
+			let isGoods = item.prizeType == 'GOODS'
+			let data = {
+				"luckyDrawWinNo": this.curRevice.luckyDrawWinNo
+			}
+			// 实物,发货地址
+			if(isGoods){
+				data.receiverName = params.receiverName
+				data.receiverPhone = params.receiverPhone
+				data.receiveAddress = params.receiveAreasName +' '+ params.receiveAddress
+			}
+			receive(data).then(res => {
+				if(res.status == 200){
+					uni.showToast({
+						title: res.message,
+						icon: 'none'
+					})
+					
+					if(isGoods){
+						this.showAddr = false
+					}else{
+						this.showLjLd = true
+					}
+					
+					this.list = []
+					this.getfindWinPrize()
+				}
+			})
+		}
+	} 
+}
+</script>
+
+<style lang="less">
+	.page-cont{
+		width: 100%;
+		padding: 20rpx;
+		.list{
+			display: flex;
+			align-items: center;
+			> view{
+				padding: 15rpx;
+				color: #FFFFFF;
+				background-color: #01c9b2;
+				border-right: 1px solid #FFFFFF;
+				border-bottom: 1px solid #FFFFFF;
+				text-align: center;
+			}
+			.no{
+				width: 150rpx;
+			}
+			.names{
+				width: 50%;
+				flex-grow: 1;
+			}
+			.lingjiang{
+				background-color: #ffaa00;
+				color: #FFFFFF;
+				width: 25%;
+			}
+			.viewsDetail{
+				background-color: #008273;
+				color: #FFFFFF;
+				width: 25%;
+			}
+		}
+		.tell{
+			color: #0A98D5;
+		}
+		.lottery-content{
+			height: 100%;
+			position: relative;
+			background: url(../../static/lottery_winbg1.png) no-repeat center top;
+			background-size: 100% auto;
+			.lottery-confrim-btn{
+				width: 100%;
+				display: flex;
+				justify-content: center;
+				font-size: 32rpx;
+				border-top: 1px solid #eee;
+				padding: 30rpx 0;
+				color: #21d5c0;
+			}
+			.lottery-title{
+				padding: 20rpx 30rpx;
+				text-align: center;
+				color: #FFFFFF;
+				font-size: 36rpx;
+				font-weight: bold;
+			}
+			.lottery-form{
+				padding: 80rpx 30rpx 20rpx;
+				> view{
+					display: flex;
+					padding: 10rpx;
+					.labes{
+						width: 150rpx;
+					}
+					>view{
+						&:last-child{
+							flex-grow: 1;
+							width: 80%;
+							color: #666;
+							display: flex;
+							align-items: center;
+							text{
+								word-break: break-all;
+							}
+						}
+					}
+				}
+			}
+			.lottery-msg{
+				padding: 70rpx 60rpx;
+				text-align: center;
+				line-height: 42rpx;
+			}
+			.lottery-u-form{
+				padding: 50rpx;
+				.receiveAddress{
+					width: 100%;
+					line-height: 1.5em;
+					box-sizing: border-box;
+					font-style: normal;
+				}
+			}
+		}
+	}
+</style>

+ 81 - 0
pagesA/luckDraw/paySuccess.vue

@@ -0,0 +1,81 @@
+<template>
+	<view class="page-cont">
+		<view class="icon-cont">
+			<u-icon class="icon" name="checkmark" color="#fff" size="80"></u-icon>
+			<view>支付成功</view>
+			<view class="pay-info"><text>{{gold}}</text><image src="../../static/ledou.png"></image></view>
+		</view>
+		<view class="back-btn">
+			<u-button type="success" @click="toLuckDraw">去抽奖</u-button>
+		</view>
+	</view>
+</template>
+
+<script>
+export default {
+	data() {
+		return {
+			gold: '' //金币
+		}
+	},
+	onLoad(option) {
+		console.log(option,'option')
+		this.gold = option.gold
+	},
+	methods: {
+		// 去抽奖
+		toLuckDraw() {
+			uni.navigateBack()
+		}
+	}
+}
+</script>
+
+<style lang="less">
+	page{
+		height: 100%;
+	}
+	.page-cont{
+		width: 100%;
+		height: 100%;
+		background-color: #fff;
+		padding: 40upx;
+		.icon-cont{
+			width: 100%;
+			height: 400upx;
+			display: flex;
+			flex-direction: column;
+			align-items: center;
+			justify-content: center;
+			>view{
+				font-size: 30upx;
+				margin-top: 30upx;
+				color: #00aa00;
+			}
+			.pay-info{
+				font-size: 50rpx;
+				color: #666;
+				image{
+					width: 40rpx;
+					height: 40rpx;
+				}
+				text{
+					color: red;
+					font-weight: bold;
+				}
+			}
+		}
+		.icon{
+			width: 120upx;
+			height: 120upx;
+			background-color: #07c160;
+			display: flex;
+			justify-content: center;
+			border-radius: 50%;
+		}
+		.back-btn{
+			margin-top: 40upx;
+			padding: 0 20%;
+		}
+	}
+</style>

+ 5 - 0
pages/order/LogList.vue → pagesA/order/LogList.vue

@@ -70,6 +70,11 @@
 				this.orderSn = option.orderNo
 				this.getRow()
 			}
+			// 开启分享
+			uni.showShareMenu({
+				withShareTicket: true,
+				menus: ['shareAppMessage', 'shareTimeline']
+			})
 		},
 		methods: {
 			// scroll-view到底部加载更多

+ 8 - 6
pages/order/order.vue → pagesA/order/order.vue

@@ -197,6 +197,11 @@
 			// 监听页面刷新事件 在详情支付成功后或在物流确认收货后刷新列表
 			uni.$on('refresh', this.handleRefresh)
 			this.pageInit()
+			// 开启分享
+			uni.showShareMenu({
+				withShareTicket: true,
+				menus: ['shareAppMessage', 'shareTimeline']
+			})
 		},
 		onUnload() {
 			uni.$off('refresh', this.handleRefresh)
@@ -410,7 +415,7 @@
 						setTimeout(()=>{
 							// 跳转到支付完成界面
 							uni.navigateTo({
-								url:"/pages/toOrder/payFinish?id=" + this.orderId
+								url:"/pagesA/toOrder/payFinish?id=" + this.orderId
 							})
 						},500)
 						
@@ -430,18 +435,15 @@
 			showLog(item) {
 				console.log(item, '111111')
 				uni.navigateTo({
-					url: "/pages/order/LogList?orderNo=" + item.orderNo
+					url: "/pagesA/order/LogList?orderNo=" + item.orderNo
 				})
 			},
 			// 详细页
 			viewRow(item) {
-				// if (!this.$hasPermissions('M_backlog_detail_mobile')) {
-				// 	return
-				// }
 				console.log(item, '111111')
 				// 已完成的
 				uni.navigateTo({
-					url: "/pages/order/orderDetail?id=" + item.id
+					url: "/pagesA/order/orderDetail?id=" + item.id
 				})
 			},
 		}

+ 6 - 1
pages/order/orderDetail.vue → pagesA/order/orderDetail.vue

@@ -150,6 +150,11 @@
 				this.orderId = options.id
 				this.getOrderDetail()
 			}
+			// 开启分享
+			uni.showShareMenu({
+				withShareTicket: true,
+				menus: ['shareAppMessage', 'shareTimeline']
+			})
 		},
 		computed: {
 			
@@ -266,7 +271,7 @@
 						uni.$emit('refresh')
 						// 跳转到支付完成界面
 						uni.navigateTo({
-							url:"/pages/toOrder/payFinish?id=" + id
+							url:"/pagesA/toOrder/payFinish?id=" + id
 						})
 					} else{
 						this.password = ''

+ 166 - 0
pagesA/taskList/taskList.vue

@@ -0,0 +1,166 @@
+<template>
+	<view class="content">
+		<view class="task-list" v-for="(item,index) in list" :key="index">
+			<view class="task-l">
+				<u-image width="80rpx" height="80rpx" :src="`/static/${item.taskCode}.png`"></u-image>
+				<view class="task-l-info">
+					<view class="task-l-title">{{item.taskCodeDictValue}}</view>
+					<view class="task-l-desc">赚<text>{{item.giveTimes}}</text>次抽奖 <u-image width="22rpx" height="22rpx" src="/static/zpIcon.png"></u-image></view>
+				</view>
+			</view>
+			<view class="task-r">
+				<u-button size="medium" v-if="item.state==1||item.taskCode=='NEW_CUSTOMER'" :custom-style="{padding:'6px 10px',width:'100%',background:'#989898',color:'#ffffff'}">已完成</u-button>
+				<u-button size="medium" v-else-if="item.state==0 && item.taskCode=='SHARE_FRIEND'" open-type="share" :custom-style="{padding:'6px 10px',width:'100%',background:'#02c9b2',color:'#ffffff'}">立即分享</u-button>
+				<u-button size="medium" v-else @click="showYdao" :custom-style="{padding:'6px 10px',width:'100%',background:'#02c9b2',color:'#ffffff'}">立即前往</u-button>
+			</view>
+		</view>
+		
+		<u-popup v-model="showYd" mode="center" close-icon-color="#ffffff" closeable :border-radius="30" width="500rpx" height="550rpx">
+			<view class="lottery-content">
+				<view class="lottery-title">
+					<image src="/static/tdsm.jpg"></image>
+				</view>
+				<view @click="toViewZn" class="lottery-confrim-btn">
+					查看使用指南
+				</view>
+			</view>
+		</u-popup>
+	</view>
+</template>
+
+<script>
+	import { findCustomerTask, doTask } from '@/api/luckyDraw.js'
+	export default {
+		data() {
+			return {
+				showYd: false,
+				list: [], // 任务列表
+				luckDraw: null,
+				id:''
+			}
+		},
+		onLoad(option) {
+			if(option.id) {
+				this.id = option.id
+			}
+			this.luckDraw = this.$store.state.vuex_LuckDraw
+		},
+		onShow() {
+			this.getTaskList()
+		},
+		methods: {
+			// 获取任务列表
+			getTaskList () {
+				findCustomerTask({id:this.id}).then(res =>{
+					if(res.status == 200) {
+						console.log(res)
+						this.list = res.data
+					} else {
+						this.list = []
+					}
+				})
+			},
+			showYdao(){
+				this.showYd = true
+			},
+			toViewZn(){
+				uni.redirectTo({
+					url: '/pages/userCenter/zhinan'
+				})
+			},
+			// 做任务
+			toDoTask(taskCode){
+				doTask({luckyDrawNo:this.luckDraw.luckyDrawNo,taskCode:taskCode}).then(res => {
+					if(res.status == 200){
+						uni.showToast({
+							icon: 'none',
+							title: '分享成功'
+						})
+					}
+				})
+			}
+		},
+		onShareAppMessage() {
+			this.toDoTask('SHARE_FRIEND')
+			return {
+			      title: '[乐色管家]参与垃圾分类,让城市更美丽!好运等你转出来!',
+			      path: '/pagesA/luckDraw/luckDraw',
+				  imageUrl:'/static/zpthumbr.jpg'
+			    }
+		},
+		onShareTimeline() {
+			this.toDoTask('SHARE_FRIEND')
+			return {
+				title: '[乐色管家]参与垃圾分类,让城市更美丽!好运等你转出来!',
+				imageUrl:'/static/zpthumbr.jpg',
+				query: 'fromType=timeline'
+			}
+		}
+	}
+</script>
+
+<style lang="less">
+	.content{
+		width: 100%;
+		padding: 0;
+		// 弹框提示
+		.lottery-content{
+			display: flex;
+			justify-content: center;
+			height: 100%;
+			position: relative;
+			background: url(../../static/lottery_winbg1.png) no-repeat center top;
+			background-size: 100% auto;
+			.lottery-confrim-btn{
+				width: 100%;
+				display: flex;
+				justify-content: center;
+				position: absolute;
+				bottom: 0;
+				left: 0;
+				color: #21d5c0;
+				font-size: 32rpx;
+				border-top: 1px solid #eee;
+				padding: 30rpx 0;
+			}
+			.lottery-title{
+				padding: 100rpx 50rpx;
+				display: flex;
+				text-align: center;
+				image{
+					width: 450rpx;
+					height: 320rpx;
+				}
+			}
+		}
+	}
+	.task-list{
+		display: flex;
+		align-items: center;
+		padding: 20rpx 40rpx;
+		border-bottom: 1px solid #eee;
+		background-color: #FFFFFF;
+		.task-l{
+			width: 80%;
+			display: flex;
+			align-items: center;
+			.task-l-info{
+				flex-grow: 1;
+				padding: 0 15rpx;
+				.task-l-title{
+					font-weight: bold;
+				}
+				.task-l-desc{
+					display: flex;
+					align-items: center;
+					font-size: 24rpx;
+					color: #666;
+					margin-top: 5rpx;
+				}
+			}
+		}
+		.task-r{
+			width: 20%;
+		}
+	}
+</style>

+ 5 - 0
pages/toOrder/editAddress.vue → pagesA/toOrder/editAddress.vue

@@ -59,6 +59,11 @@
 					title: '新增地址'
 				})
 			}
+			// 开启分享
+			uni.showShareMenu({
+				withShareTicket: true,
+				menus: ['shareAppMessage', 'shareTimeline']
+			})
 		},
 		onUnload() {
 			this.$u.vuex("vuex_OrderAddress",{})

+ 8 - 3
pages/toOrder/index.vue → pagesA/toOrder/index.vue

@@ -138,6 +138,11 @@
 			this.goodsList = this.$store.state.vuex_toOrderList
 			// 监听设置密码是否成功
 			uni.$once('setPswSuccess', this.setPsw)
+			// 开启分享
+			uni.showShareMenu({
+				withShareTicket: true,
+				menus: ['shareAppMessage', 'shareTimeline']
+			})
 		},
 		computed: {
 			// 总计
@@ -172,7 +177,7 @@
 			editAddress(){
 				this.$u.vuex("vuex_OrderAddress",this.userInfo)
 				uni.navigateTo({
-					url:"/pages/toOrder/editAddress"
+					url:"/pagesA/toOrder/editAddress"
 				})
 			},
 			// 跳转到设置支付密码页
@@ -198,7 +203,7 @@
 				this.password = ''
 				// 跳转到订单列表
 				uni.redirectTo({
-					url:"/pages/order/order"
+					url:"/pagesA/order/order"
 				})
 			},
 			// 继续支付
@@ -292,7 +297,7 @@
 					if(res.status == 200) {
 						// 跳转到支付完成界面
 						uni.redirectTo({
-							url:"/pages/toOrder/payFinish?id=" + this.orderId
+							url:"/pagesA/toOrder/payFinish?id=" + this.orderId
 						})
 					} else{
 						this.password = ''

+ 6 - 1
pages/toOrder/payFinish.vue → pagesA/toOrder/payFinish.vue

@@ -21,12 +21,17 @@ export default {
 	onLoad(option) {
 		console.log(option,'option')
 		this.orderId = option.id
+		// 开启分享
+		uni.showShareMenu({
+			withShareTicket: true,
+			menus: ['shareAppMessage', 'shareTimeline']
+		})
 	},
 	methods: {
 		// 查看订单详情
 		toOrderDetail() {
 			uni.redirectTo({
-			    url: '/pages/order/orderDetail?id=' + this.orderId
+			    url: '/pagesA/order/orderDetail?id=' + this.orderId
 			})
 		},
 		// 返回首页

BIN
static/FIRST_DELIVERY.png


BIN
static/FIRST_ONLINE_EXCHANGE.png


BIN
static/NEW_CUSTOMER.png


BIN
static/NEW_FIRST_DELIVER.png


BIN
static/OLD_FIRST_DELIVER.png


BIN
static/SHARE_FRIEND.png


BIN
static/almost-lottery/almost-lottery__action.png


BIN
static/almost-lottery/almost-lottery__action2x.png


BIN
static/almost-lottery/almost-lottery__action3x.png


BIN
static/almost-lottery/almost-lottery__bg.png


BIN
static/almost-lottery/almost-lottery__bg2x.png


BIN
static/almost-lottery/almost-lottery__bg3x.png


BIN
static/closeLottery.png


BIN
static/lottery-cjgz.png


BIN
static/lottery_winbg1.png


BIN
static/lottery_winbg2.png


BIN
static/luckwheel-fixed1.gif


BIN
static/nozj.png


BIN
static/shift.png


BIN
static/tdsm.jpg


BIN
static/toLottery.png


BIN
static/zpIcon.png


BIN
static/zpthumbr.jpg


+ 4 - 1
store/index.js

@@ -116,7 +116,10 @@ const store = new Vuex.Store({
 		// 客服电话
 		vuex_kfMobile: '4008826012',
 		vuex_noLogin: false,
-		vuex_isClick: false
+		vuex_isClick: false,
+		// 大转盘
+		vuex_LuckDraw: null,
+		vuex_LuckDrawTimes: 0
 	},
 	mutations: {
 		$uStore(state, payload) {

Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels