activityDetail.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407
  1. <template>
  2. <view class="flex-col page">
  3. <view class="flex-col content">
  4. <view class="out1">
  5. <view class="flex-col top">
  6. <view class="flex-row title">
  7. <text>{{ activity.title }}</text>
  8. </view>
  9. <view class="flex-row price">
  10. <text v-if="isShare">¥{{ activity.sharePrice }}</text>
  11. <text
  12. :style="{textDecorationLine:(isShare ?'line-through' :'none'),color:(isShare ? '#878787':''), fontSize:(isShare ? '24rpx':'') }">
  13. ¥{{ activity.salePrice }}
  14. </text>
  15. </view>
  16. <view class="flex-row">
  17. <view class="activityKey ">
  18. <text>活动时间:</text>
  19. </view>
  20. <view>
  21. <text v-if="activity.valid == 2">{{ activity.validBeginTime.substring(0, 10) }} 至
  22. {{ activity.validEndTime.substring(0, 10) }}
  23. </text>
  24. <text v-else>长期有效</text>
  25. </view>
  26. </view>
  27. <view class="flex-row">
  28. <view class="activityKey">
  29. <text>活动门店:</text>
  30. </view>
  31. <view class="activityValue">
  32. <text>{{ activity.partStoreName }}</text>
  33. </view>
  34. </view>
  35. <view class="flex-row">
  36. <view class="activityKey ">
  37. <text>活动描述:</text>
  38. </view>
  39. <view class="activityValue">
  40. <text>{{ activity.description }}</text>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. <!-- <view class="out1">-->
  46. <!-- <view class="flex-col top1">-->
  47. <!-- <view class="flex-row justify-center title">-->
  48. <!-- <text>退款策略(模块标题)</text>-->
  49. <!-- </view>-->
  50. <!-- <view class="flex-row">-->
  51. <!-- <text>-->
  52. <!-- 活动描述活动描述活动描述活动描述活动描述活动描述活动描述活动描述活动描述活动描述活动描述活动描述活动描述活动描述活动描述活动描述活动描述活动描述活动描述-->
  53. <!-- </text>-->
  54. <!-- </view>-->
  55. <!-- </view>-->
  56. <!-- </view>-->
  57. <view class="out2" v-if="activity.couponList">
  58. <view class="flex-col ticket">
  59. <view class="flex-row justify-center title">
  60. <text>赠送优惠券</text>
  61. </view>
  62. <view class="flex-row ticketList" v-for="(i,index) in activity.couponList">
  63. <view class="h-text flex-col justify-center ">
  64. <text class="money" v-if="i.discountsType == 2">{{ i.discount }}折</text>
  65. <text class="money" v-else>{{ i.discountsPrice }}</text>
  66. <text class="desc">满{{ i.reachPrice }}可用</text>
  67. </view>
  68. <view class="h-center-content flex-col justify-around">
  69. <view class="h-value">
  70. <text>{{ i.name }}</text>
  71. </view>
  72. <!-- <view class="ticketMsg">-->
  73. <!-- 使用平台:-->
  74. <!-- <text>全平台</text>-->
  75. <!-- </view>-->
  76. <view class="ticketMsg">
  77. 使用次数:{{ i.degree }}
  78. </view>
  79. <view class="ticketMsg">
  80. 服务项目:{{ i.useServiceDesc }}
  81. </view>
  82. <view class="ticketMsg">
  83. <text v-if="i.validType == 1">领取后{{ i.effectiveDays }}天内有效</text>
  84. <view v-else>
  85. <view>使用期限:{{ i.startTime.substring(0, 10) }} 至 {{ i.endTime.substring(0, 10) }}</view>
  86. </view>
  87. </view>
  88. <!-- <view class="ticketMsg flex-row">-->
  89. <!-- <text @click.stop="showRemark(item)">使用规则</text>-->
  90. <!-- <u-icon v-if="item.id == showRemarkId" name="arrow-down-fill" color="" size="12"></u-icon>-->
  91. <!-- <u-icon v-else name="play-right-fill" color="" size="12"></u-icon>-->
  92. <!-- </view>-->
  93. </view>
  94. </view>
  95. </view>
  96. <!-- <view class="flex-row justify-between link">-->
  97. <!-- <text>跳转一</text>-->
  98. <!-- <u-icon name="arrow-right" color="" size="12"></u-icon>-->
  99. <!-- </view>-->
  100. <!-- <view class="flex-row justify-between link">-->
  101. <!-- <text>跳转一</text>-->
  102. <!-- <u-icon name="arrow-right" color="" size="12"></u-icon>-->
  103. <!-- </view>-->
  104. </view>
  105. <view class="out2" v-if="activity.equityList">
  106. <view class="flex-col ticket">
  107. <view class="flex-row justify-center title">
  108. <text>赠送权益卡</text>
  109. </view>
  110. <view class="flex-row ticketList" v-for="(i,index) in activity.equityList">
  111. <view class="h-text flex-col justify-center ">
  112. <text class="money">{{ i.faceValue }}</text>
  113. <text class="desc">权益价</text>
  114. </view>
  115. <view class="h-center-content flex-col justify-around">
  116. <view class="h-value">
  117. <text>{{ i.title }}</text>
  118. </view>
  119. <view class="ticketMsg">
  120. 适用门店:{{ i.useStoreDesc || '' }}
  121. </view>
  122. <view class="ticketMsg">
  123. 领取后{{ i.effectiveDays }}天内有效
  124. </view>
  125. </view>
  126. </view>
  127. </view>
  128. </view>
  129. <view class="out2" v-if="activity.rechargeList">
  130. <view class="flex-col ticket">
  131. <view class="flex-row justify-center title">
  132. <text>赠送储值卡</text>
  133. </view>
  134. <view class="flex-row ticketList" v-for="(i,index) in activity.rechargeList">
  135. <view class="h-text flex-col justify-center ">
  136. <text class="money">{{ i.reachPrice }}</text>
  137. <text class="desc">储值额度</text>
  138. </view>
  139. <view class="h-center-content flex-col justify-around">
  140. <view class="h-value">
  141. <text>{{ i.name }}</text>
  142. </view>
  143. </view>
  144. </view>
  145. </view>
  146. </view>
  147. </view>
  148. <view class="flex-row justify-center inBtnView">
  149. <view class="inBtn" @click="beforeCommitOrder" v-if="!isActivityCheck">立即参与</view>
  150. <view class="inBtn" v-else>已参与</view>
  151. </view>
  152. <myPay ref="myPay" :selectBlPay="userInfo.balance *1 >= totalAmount *1" :balance="userInfo.balance"
  153. :totalAmount="totalAmount" :lovePay="false" :blPay="false"
  154. :orderNo="subOrderNo" @payResult="payResult" @improperClose="improperClose"></myPay>
  155. <view>
  156. <u-picker :show="show" title="选择服务对象" :closeOnClickOverlay="true" @close="show = false"
  157. :columns="serviceObjectList"
  158. keyName="nickName" @cancel="show = false" @confirm="confirm"></u-picker>
  159. </view>
  160. </view>
  161. </template>
  162. <script>
  163. import myPay from '../../components/pay/pay';
  164. export default {
  165. components: {
  166. myPay
  167. },
  168. data() {
  169. return {
  170. userInfo: {},
  171. subOrderNo: '',
  172. id: '',
  173. storeId: '',
  174. userId: '',
  175. techNo: '',
  176. activity: {},
  177. requestStatus: false,
  178. isActivityCheck: true, //是否参与过该活动
  179. serviceObjectList: [],
  180. show: false,
  181. serviceObjectId: null,
  182. isShare: false,
  183. inviteUserId: null,
  184. inviteOrderId: null,
  185. }
  186. },
  187. computed: {
  188. totalAmount() {
  189. if (this.isShare) {
  190. return this.activity.sharePrice
  191. } else {
  192. return this.activity.salePrice
  193. }
  194. }
  195. },
  196. onLoad(e) {
  197. console.log(e)
  198. if (e.id) {
  199. this.id = e.id
  200. console.log('上一个页面传递过来的活动ID===>', this.id)
  201. }
  202. if (e.inviteUserId) {
  203. console.log(e)
  204. this.id = e.activityId
  205. this.inviteUserId = e.inviteUserId
  206. this.inviteOrderId = e.inviteOrderId
  207. this.isShare = true
  208. }
  209. // 扫技师端携带的参数,已存在缓存中
  210. let promotionParam = uni.getStorageSync('promotionParam')
  211. if (promotionParam) {
  212. console.log('获取到技师的二维码数据', promotionParam)
  213. this.storeId = promotionParam.storeId
  214. this.techNo = promotionParam.techNo
  215. } else {
  216. let storeParam = uni.getStorageSync('storeParam')
  217. // console.log('获取到门店的二维码数据',param)
  218. this.storeId = storeParam.storeId
  219. }
  220. if (e.q) {
  221. //扫店长端二维码进来的活动参数
  222. const q = decodeURIComponent(e.q)
  223. let a = q.split('?')
  224. let b = a[1].split('&')
  225. let param = {} //技师端分享过来的参数
  226. for (let i = 0; i < b.length; i++) {
  227. param[b[i].split('=')[0]] = b[i].split('=')[1]
  228. }
  229. this.id = param.activityId
  230. this.storeId = param.storeId
  231. this.techNo = ''
  232. console.log("扫店长端二维码进来的活动参数===》", param)
  233. uni.setStorageSync('storeParam', param)
  234. uni.removeStorageSync('promotionParam');
  235. }
  236. this.userInfo = uni.getStorageSync('userInfo')
  237. this.activityDetail()
  238. this.activityCheck()
  239. this.listServiceObject()
  240. },
  241. methods: {
  242. // 查询服务对像信息列表
  243. listServiceObject() {
  244. let serviceObjectList = []
  245. this.$api.listServiceObject(this.reqParm).then((res) => {
  246. res.data.data.forEach(i => {
  247. if (i.isSelf != 1) {
  248. serviceObjectList.push(i)
  249. }
  250. })
  251. this.serviceObjectList[0] = serviceObjectList
  252. })
  253. },
  254. //支付结果回调
  255. payResult(e) {
  256. console.log(e)
  257. if (e.payResult) {
  258. uni.showToast({
  259. duration: 2000,
  260. title: '支付成功!'
  261. });
  262. this.isActivityCheck = true
  263. } else {
  264. uni.showToast({
  265. duration: 2000,
  266. title: '支付失败!',
  267. icon: 'error'
  268. });
  269. }
  270. },
  271. //支付弹窗关闭回调
  272. improperClose() {
  273. },
  274. beforeCommitOrder() {
  275. if (this.activity.isAddServiceObject == 1) {
  276. this.show = true
  277. } else {
  278. this.commitOrder()
  279. }
  280. },
  281. confirm(e) {
  282. console.log(e)
  283. this.serviceObjectId = e.value[0].id
  284. this.show = false
  285. this.commitOrder()
  286. },
  287. //提交订单
  288. commitOrder() {
  289. // if (this.subOrderNo){
  290. // this.$refs.myPay.openPopup()
  291. // }else {
  292. if (this.requestStatus) {
  293. return;
  294. }
  295. this.requestStatus = true
  296. uni.showLoading({
  297. title: '加载中'
  298. });
  299. this.$api.commonGeneralOrder({
  300. orderType: 7,
  301. serviceObjectId: this.serviceObjectId,
  302. activityId: this.activity.id,
  303. storeId: this.storeId,
  304. inviteUserId: this.inviteUserId,
  305. techNo: this.techNo
  306. }).then(res => {
  307. console.log('++++++++++++++++++订单提交+++++++++++', res)
  308. uni.hideLoading();
  309. this.subOrderNo = res.data.data.orderNo
  310. if (this.activity.salePrice * 1 > 0) {
  311. this.$refs.myPay.openPopup()
  312. } else {
  313. uni.showToast({
  314. duration: 2000,
  315. title: '活动参与成功!'
  316. });
  317. this.isActivityCheck = true
  318. }
  319. this.requestStatus = false
  320. }).catch(err => {
  321. this.requestStatus = false
  322. })
  323. // }
  324. },
  325. activityDetail() {
  326. console.log(this.id, '活动ID')
  327. const data = {
  328. id: this.id,
  329. }
  330. if (this.inviteUserId) {
  331. data.userId = this.inviteUserId
  332. }
  333. if (this.inviteOrderId) {
  334. data.inviteOrderId = this.inviteOrderId
  335. }
  336. this.$api.activityDetail(data).then(res => {
  337. console.log(res)
  338. this.activity = res.data.data
  339. this.$set(this.activity)
  340. if (this.isShare) {
  341. console.log(this.activity)
  342. if (this.activity.shareMax !== 0 && this.activity.shareMax < this.activity.shareCount) {
  343. this.isShare = false
  344. uni.showToast({
  345. duration: 3000,
  346. title: '已经超出最大分享次数',
  347. icon: 'none'
  348. });
  349. }
  350. }
  351. })
  352. },
  353. activityCheck() {
  354. this.$api.activityCheck({activityId: this.id,}).then(res => {
  355. console.log(res)
  356. this.isActivityCheck = res.data.data
  357. })
  358. }
  359. }
  360. }
  361. </script>
  362. <style lang="scss" scoped>
  363. @import '/common/css/common.css';
  364. @import './index.rpx.scss';
  365. </style>