activityDetail.vue 13 KB

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