index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  1. <template>
  2. <view class="page">
  3. <view :style="{'height':height}">
  4. <scroll-view :style="{'height':height}" scroll-y>
  5. <view class="block_2 flex-row justify-start " v-for="(item,index) in projects.projectVos" :key="index" @click="clickItem(item)" >
  6. <view class="flex-col justify-center ">
  7. <u-icon v-if="item.id === serviceProjectId" name="checkmark-circle-fill" color="#38db38" size="25"></u-icon>
  8. <u-icon v-else name="/static/order/ud9.png" color="green" size="25"></u-icon>
  9. </view>
  10. <view class="outView ">
  11. <text lines="1" class="text_3">{{item.serviceName}}</text>
  12. <view class="group_2 ">
  13. <view class="image-text_2">
  14. <u-icon name="server-man" size="16"></u-icon>
  15. <text lines="1" class="text-group_2">服务人员:</text>
  16. <text lines="1" class="text_5">{{projects.personName}}</text>
  17. </view>
  18. <!-- <view class="group_3">-->
  19. <!-- <u-icon name="clock" size="16"></u-icon>-->
  20. <!-- <text lines="1" class="text-group_2">服务时间:</text>-->
  21. <!-- <text lines="1" decode="true" class="text_5">2023-8-14&nbsp;12:33:55</text>-->
  22. <!-- </view>-->
  23. </view>
  24. <view class="text-wrapper_3 flex-row justify-start">
  25. <text lines="1" class="text_7">标准价:</text>
  26. <text lines="1" class="text_8">¥{{item.standardPrice}}</text>
  27. <!-- <text lines="1" class="text_9 text_7">会员价:</text>-->
  28. <!-- <text lines="1" class="text_8">¥{{item.memberPrice}}</text>-->
  29. </view>
  30. <view class="box_4"></view>
  31. </view>
  32. </view>
  33. </scroll-view>
  34. </view>
  35. <!-- <view class="tabBarLineHeight"></view>-->
  36. <view class="bottomView">
  37. <!-- <view class="ticketView flex-row">-->
  38. <!-- <view class="ticketBtn" :class="{'ticketColor': ticketBtnIndex === 1}" @click="clickTicketBtn(1)">-->
  39. <!-- <text>使用权益券</text>-->
  40. <!-- </view>-->
  41. <!-- <view class="ticketBtn" :class="{'ticketColor': ticketBtnIndex === 2}" @click="clickTicketBtn(2)">-->
  42. <!-- <text>使用优惠券</text>-->
  43. <!-- </view>-->
  44. <!-- </view>-->
  45. <!-- <view v-if="ticketBtnIndex === 1" class="flex-row justify-center" @click="goUseRights">-->
  46. <!-- <view class="block_3 ">-->
  47. <!-- <text lines="1" class="text_15">权益卡</text>-->
  48. <!-- <view>-->
  49. <!-- <view class="flex-row justify-between" v-if="equitys.length>0">-->
  50. <!-- <view class="flex-row">-->
  51. <!-- <text class="text-group_5" v-for="(iter,i) in equitys" :key="i">{{iter.description}}</text>-->
  52. <!-- </view>-->
  53. <!-- <u-icon name="arrow-right" color="#666" size="18"></u-icon>-->
  54. <!-- </view>-->
  55. <!-- <view v-else class="image-text_4 ">-->
  56. <!-- <text class="text-group_4">未选择</text>-->
  57. <!-- <u-icon name="arrow-right" color="#666" size="18"></u-icon>-->
  58. <!-- </view>-->
  59. <!-- </view>-->
  60. <!-- </view>-->
  61. <!-- </view>-->
  62. <!-- <view v-if="ticketBtnIndex === 2" class="flex-row justify-center" @click="goUseCoupons">-->
  63. <!-- <view class="block_3 ">-->
  64. <!-- <text lines="1" class="text_15">优惠券</text>-->
  65. <!-- <view>-->
  66. <!-- <view class="flex-row justify-between" v-if="coupons.length>0">-->
  67. <!-- <view class="flex-row">-->
  68. <!-- <text class="text-group_5" v-for="(iter,i) in coupons" :key="i">{{iter.name}}:-¥{{iter.discountsPrice}}</text>-->
  69. <!-- </view>-->
  70. <!-- <u-icon name="arrow-right" color="#666" size="18"></u-icon>-->
  71. <!-- </view>-->
  72. <!-- <view v-else class="image-text_4 ">-->
  73. <!-- <text class="text-group_4">未选择</text>-->
  74. <!-- <u-icon name="arrow-right" color="#666" size="18"></u-icon>-->
  75. <!-- </view>-->
  76. <!-- </view>-->
  77. <!-- </view>-->
  78. <!-- </view>-->
  79. <!-- <view class="selectType flex-row justify-between" @click="popupClick">-->
  80. <!-- <text>请选择优惠方式</text>-->
  81. <!-- <text class="text-group_5" v-if="ticketBtnIndex === 1" v-for="(iter,i) in equitys" :key="i">{{iter.title}}</text>-->
  82. <!-- <text class="text-group_5" v-if="ticketBtnIndex === 2" v-for="(iter,i) in coupons" :key="i">{{iter.name}}:-¥{{iter.discountsPrice}}</text>-->
  83. <!-- <u-icon name="arrow-right" color="#666" size="18"></u-icon>-->
  84. <!-- </view>-->
  85. <view class="flex-row justify-center">
  86. <view class=" submitButtonLeft" @click="popupClick">
  87. <text v-if="(ticketBtnIndex === 1 && equitys.length===0) || (ticketBtnIndex === 2 && coupons.length === 0)">使用权益卡或优惠券</text>
  88. <text class="text-group_5" v-else-if="ticketBtnIndex === 1" v-for="(iter,i) in equitys" :key="i">{{iter.title}}</text>
  89. <text class="text-group_5" v-else-if="ticketBtnIndex === 2" v-for="(iter,i) in coupons" :key="i">{{iter.name}}:-{{iter.discountsPrice}}</text>
  90. </view>
  91. <view class="submitButton " @click="addChildProject">确定</view>
  92. </view>
  93. </view>
  94. <uni-popup ref="popup" type="bottom" >
  95. <view class="popupView flex-row justify-around">
  96. <view class="flex-col justify-center" @click="goUseRights">
  97. <view class="flex-row justify-center">
  98. <u-icon name="/static/me/u694.png" color="#666" size="40"></u-icon>
  99. </view>
  100. <view class="imageText flex-row justify-center">
  101. <text>88卡用户</text>
  102. </view>
  103. </view>
  104. <view class="flex-col justify-center " @click="goUseCoupons">
  105. <view class="flex-row justify-center">
  106. <u-icon name="/static/me/u687.png" color="#666" size="40"></u-icon>
  107. </view>
  108. <view class="imageText flex-row justify-center">
  109. <text>优惠券</text>
  110. </view>
  111. </view>
  112. </view>
  113. </uni-popup>
  114. </view>
  115. </template>
  116. <script>
  117. export default {
  118. components: {
  119. },
  120. data() {
  121. return {
  122. height:'',
  123. coupons:[],
  124. equitys:[],
  125. couponIds:'',
  126. tabIndex: 3,
  127. projects:{},
  128. serviceStationId:'',
  129. orderId:'',
  130. serviceProject:{},
  131. serviceProjectId:'',
  132. serviceObjectId:'',
  133. ticketBtnIndex:1
  134. }
  135. },
  136. onLoad(e) {
  137. // 判断Openid是否为空
  138. let sysInfo=uni.getSystemInfoSync();
  139. this.height= sysInfo.windowHeight -80 +'px';
  140. this.orderId=e.orderId
  141. this.serviceStationId=e.serviceStationId
  142. this.serviceObjectId=e.serviceObjectId
  143. this.getStationById(e.serviceStationId)
  144. uni.$off('getUseCoupons')
  145. uni.$on('getUseCoupons',this.getUseCoupons)
  146. uni.$on('getEquity',this.getEquity)
  147. },
  148. methods: {
  149. popupClick(){
  150. this.$refs.popup.open()
  151. },
  152. clickTicketBtn(ticketBtnIndex){
  153. this.ticketBtnIndex =ticketBtnIndex
  154. },
  155. getEquity(e){
  156. this.equitys =e
  157. },
  158. goUseRights(){
  159. this.$refs.popup.close()
  160. if (this.serviceProjectId.length === 0){
  161. uni.$u.toast('请先选择服务项目')
  162. return
  163. }
  164. this.ticketBtnIndex = 1
  165. uni.navigateTo({
  166. url:'/storePages/useRights/index?serviceProjectId=' + this.serviceProjectId + '&serviceObjectId=' + this.serviceObjectId
  167. })
  168. },
  169. getUseCoupons(e){
  170. console.log('++++++++getUseCoupons+++++++++++++++',e)
  171. this.coupons= e
  172. this.couponIds = ''
  173. for (let eElement of e) {
  174. this.couponIds += eElement.id + ','
  175. }
  176. if (this.couponIds.length>0){
  177. this.couponIds = this.couponIds.substring(0,this.couponIds.length-1)
  178. }
  179. },
  180. goUseCoupons(){
  181. this.$refs.popup.close()
  182. if (this.serviceProjectId.length === 0){
  183. uni.$u.toast('请先选择服务项目')
  184. return
  185. }
  186. this.ticketBtnIndex = 2
  187. uni.navigateTo({
  188. url: '/orderPages/useCoupons/index?standardPrice='+this.serviceProject.standardPrice
  189. })
  190. },
  191. clickItem(item){
  192. if (this.equitys.length>0){
  193. if (item.id != this.equitys[0].serviceObjectId){
  194. this.equitys=[]
  195. }
  196. }
  197. this.serviceProjectId = item.id
  198. this.serviceProject = item
  199. },
  200. addChildProject(){
  201. if (this.ticketBtnIndex === 1){
  202. this.couponIds=''
  203. }
  204. if (this.ticketBtnIndex === 2){
  205. this.equitys=[]
  206. }
  207. if (!this.serviceProjectId){
  208. uni.$u.toast("请选择服务项目")
  209. return
  210. }
  211. if(this.requestStatus){
  212. return;
  213. }
  214. this.requestStatus=true
  215. let userEquityCardId
  216. if (this.equitys.length>0){
  217. userEquityCardId = this.equitys[0].id
  218. }
  219. this.$api.addChildProject({
  220. orderId:this.orderId,
  221. serviceProjectId:this.serviceProjectId,
  222. servicePersonId:this.projects.personId,
  223. serviceStationId:this.serviceStationId,
  224. couponIds:this.couponIds,
  225. userEquityCardId:userEquityCardId
  226. }).then(res=>{
  227. this.requestStatus=false
  228. uni.navigateBack({
  229. delta:1
  230. })
  231. }).catch(()=>{
  232. this.requestStatus=false
  233. })
  234. },
  235. getStationById(qeCode){
  236. this.$api.getStationById({
  237. stationId:qeCode
  238. }).then(res=>{
  239. console.log('++++++++getStationById+++++++++++',res)
  240. this.projects=res.data.data
  241. })
  242. }
  243. }
  244. }
  245. </script>
  246. <style scoped lang="scss">
  247. @import '/common/css/common.css';
  248. @import './index.rpx.scss';
  249. </style>