activityDetail.vue 14 KB

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