activityDetail.vue 12 KB

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