index.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. <template>
  2. <view class="content">
  3. <view class="page">
  4. <view class="block_2 flex-row justify-start" v-for="(item,index) in projects.projectVos" :key="index" @click="clickItem(item)">
  5. <view class="flex-col justify-center ">
  6. <u-icon v-if="item.id === serviceProjectId" name="checkmark-circle-fill" color="#38db38" size="25"></u-icon>
  7. <u-icon v-else name="/static/order/ud9.png" color="green" size="25"></u-icon>
  8. </view>
  9. <view class="outView ">
  10. <text lines="1" class="text_3">{{item.serviceName}}</text>
  11. <view class="group_2 ">
  12. <view class="image-text_2">
  13. <u-icon name="server-man" size="16"></u-icon>
  14. <text lines="1" class="text-group_2">服务人员:</text>
  15. <text lines="1" class="text_5">{{projects.personName}}</text>
  16. </view>
  17. <!-- <view class="group_3">-->
  18. <!-- <u-icon name="clock" size="16"></u-icon>-->
  19. <!-- <text lines="1" class="text-group_2">服务时间:</text>-->
  20. <!-- <text lines="1" decode="true" class="text_5">2023-8-14&nbsp;12:33:55</text>-->
  21. <!-- </view>-->
  22. </view>
  23. <view class="text-wrapper_3 flex-row justify-start">
  24. <text lines="1" class="text_7">标准价:</text>
  25. <text lines="1" class="text_8">¥{{item.standardPrice}}</text>
  26. <!-- <text lines="1" class="text_9 text_7">会员价:</text>-->
  27. <!-- <text lines="1" class="text_8">¥{{item.memberPrice}}</text>-->
  28. </view>
  29. <view class="box_4"></view>
  30. </view>
  31. </view>
  32. <view class="tabBarLineHeight"></view>
  33. <view class="bottomView">
  34. <view class="ticketView flex-row">
  35. <view class="ticketBtn" :class="{'ticketColor': ticketBtnIndex === 1}" @click="clickTicketBtn(1)">
  36. <text>使用权益券</text>
  37. </view>
  38. <view class="ticketBtn" :class="{'ticketColor': ticketBtnIndex === 2}" @click="clickTicketBtn(2)">
  39. <text>使用优惠券</text>
  40. </view>
  41. </view>
  42. <view v-if="ticketBtnIndex === 1" class="flex-row justify-center" @click="goUseRights">
  43. <view class="block_3 ">
  44. <text lines="1" class="text_15">权益卡</text>
  45. <view>
  46. <view class="flex-row justify-between" v-if="equitys.length>0">
  47. <view class="flex-row">
  48. <text class="text-group_5" v-for="(iter,i) in equitys" :key="i">{{iter.description}}</text>
  49. </view>
  50. <u-icon name="arrow-right" color="#666" size="18"></u-icon>
  51. </view>
  52. <view v-else class="image-text_4 ">
  53. <text class="text-group_4">未选择</text>
  54. <u-icon name="arrow-right" color="#666" size="18"></u-icon>
  55. </view>
  56. </view>
  57. </view>
  58. </view>
  59. <view v-if="ticketBtnIndex === 2" class="flex-row justify-center" @click="goUseCoupons">
  60. <view class="block_3 ">
  61. <text lines="1" class="text_15">优惠券</text>
  62. <view>
  63. <view class="flex-row justify-between" v-if="coupons.length>0">
  64. <view class="flex-row">
  65. <text class="text-group_5" v-for="(iter,i) in coupons" :key="i">{{iter.name}}:-¥{{iter.discountsPrice}}</text>
  66. </view>
  67. <u-icon name="arrow-right" color="#666" size="18"></u-icon>
  68. </view>
  69. <view v-else class="image-text_4 ">
  70. <text class="text-group_4">未选择</text>
  71. <u-icon name="arrow-right" color="#666" size="18"></u-icon>
  72. </view>
  73. </view>
  74. </view>
  75. </view>
  76. <view class="flex-row justify-center">
  77. <view class="submitButton" @click="addChildProject">确定</view>
  78. </view>
  79. </view>
  80. </view>
  81. </view>
  82. </template>
  83. <script>
  84. export default {
  85. components: {
  86. },
  87. data() {
  88. return {
  89. coupons:[],
  90. equitys:[],
  91. couponIds:'',
  92. tabIndex: 3,
  93. projects:{},
  94. serviceStationId:'',
  95. orderId:'',
  96. serviceProject:{},
  97. serviceProjectId:'',
  98. serviceObjectId:'',
  99. ticketBtnIndex:1
  100. }
  101. },
  102. onLoad(e) {
  103. this.orderId=e.orderId
  104. this.serviceStationId=e.serviceStationId
  105. this.serviceObjectId=e.serviceObjectId
  106. this.getStationById(e.serviceStationId)
  107. uni.$off('getUseCoupons')
  108. uni.$on('getUseCoupons',this.getUseCoupons)
  109. uni.$on('getEquity',this.getEquity)
  110. },
  111. methods: {
  112. clickTicketBtn(ticketBtnIndex){
  113. this.ticketBtnIndex =ticketBtnIndex
  114. },
  115. getEquity(e){
  116. this.equitys =e
  117. },
  118. goUseRights(){
  119. if (this.serviceProjectId.length === 0){
  120. uni.$u.toast('请先选择服务项目')
  121. return
  122. }
  123. uni.navigateTo({
  124. url:'/storePages/useRights/index?serviceProjectId=' + this.serviceProjectId + '&serviceObjectId=' + this.serviceObjectId
  125. })
  126. },
  127. getUseCoupons(e){
  128. console.log('++++++++getUseCoupons+++++++++++++++',e)
  129. this.coupons= e
  130. this.couponIds = ''
  131. for (let eElement of e) {
  132. this.couponIds += eElement.id + ','
  133. }
  134. if (this.couponIds.length>0){
  135. this.couponIds = this.couponIds.substring(0,this.couponIds.length-1)
  136. }
  137. },
  138. goUseCoupons(){
  139. if (this.serviceProjectId.length === 0){
  140. uni.$u.toast('请先选择服务项目')
  141. return
  142. }
  143. uni.navigateTo({
  144. url: '/orderPages/useCoupons/index?standardPrice='+this.serviceProject.standardPrice
  145. })
  146. },
  147. clickItem(item){
  148. if (this.equitys.length>0){
  149. if (item.id != this.equitys[0].serviceObjectId){
  150. this.equitys=[]
  151. }
  152. }
  153. this.serviceProjectId = item.id
  154. this.serviceProject = item
  155. },
  156. addChildProject(){
  157. if (this.ticketBtnIndex === 1){
  158. this.couponIds=''
  159. }
  160. if (this.ticketBtnIndex === 2){
  161. this.equitys=[]
  162. }
  163. if (this.id === ''){
  164. uni.$u.toast("请选择服务项目")
  165. }
  166. this.$api.addChildProject({
  167. orderId:this.orderId,
  168. serviceProjectId:this.serviceProjectId,
  169. servicePersonId:this.projects.personId,
  170. serviceStationId:this.serviceStationId,
  171. couponIds:this.couponIds,
  172. userEquityCardId:this.equitys[0].id
  173. }).then(res=>{
  174. uni.navigateTo({
  175. url:'/orderPages/orderDetail/index?id='+ this.orderId
  176. })
  177. })
  178. },
  179. getStationById(qeCode){
  180. this.$api.getStationById({
  181. stationId:qeCode
  182. }).then(res=>{
  183. console.log('++++++++getStationById+++++++++++',res)
  184. this.projects=res.data.data
  185. })
  186. }
  187. }
  188. }
  189. </script>
  190. <style scoped lang="scss">
  191. @import '/common/css/common.css';
  192. @import './index.rpx.scss';
  193. </style>