signConfirm.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <template>
  2. <view :style="[mainStyle]">
  3. <view class="top" v-if="detail">
  4. <view class="ddflex">
  5. <image :src="detail.pic" mode="aspectFill" class="act-img"></image>
  6. <view class="fflex">
  7. <view class="title tovers">{{detail.title}}</view>
  8. <view class="area fflex ddflex">
  9. <image src="../static/images/sjico.png"></image>
  10. <view class="tover fflex">{{ getTimeText(detail.startTime,detail.endTime,true) }}</view>
  11. </view>
  12. <view class="sta ddflex" style="margin-top: 10rpx;">
  13. <view class="area fflex ddflex" v-if="detail.address">
  14. <image src="../static/images/dzico.png"></image>
  15. <view class="tover fflex">{{detail.address}}</view>
  16. </view>
  17. <!-- <view class="money" v-if="userinfovip.levelGrade>0&& !userinfovip.end">¥{{detail.vipMoney}}</view> -->
  18. <view class="money"><block v-if="price>0">¥</block>{{price>0?price:'免费'}}</view>
  19. </view>
  20. </view>
  21. </view>
  22. </view>
  23. <view class="lists">
  24. <view class="li active" v-for="item,index in personPramas" :key="index">
  25. <view class="li-top ddflex">
  26. <view class="fflex">
  27. <block v-for="it,idx in item.child" :key="idx">
  28. <view class="name" v-if="it.code == 'name'">{{it.value}}</view>
  29. <view class="phone" v-if="it.code == 'phone'">{{it.value}}</view>
  30. </block>
  31. </view>
  32. <view :class="'li-opt ddflex'+(item.isShowChild ? ' active':'')" @click="showChild(index)">{{item.isShowChild ? '收起':'展开'}}<image src="../../static/pages/images/more.png" class="rico"></image></view>
  33. </view>
  34. <view class="li-bot" v-if="item.isShowChild">
  35. <block v-for="it,idx in item.child" :key="idx">
  36. <view class="lis ddflex" v-if="it.code != 'name' && it.code != 'phone'">
  37. <view class="fflex">{{it.title}}</view>
  38. <view v-if="it.code == 'sex'">{{it.value ? item.value == 1 ? '男' : '女' : '--'}}</view>
  39. <view v-else>{{it.value ? it.value : '--'}}</view>
  40. </view>
  41. </block>
  42. </view>
  43. </view>
  44. </view>
  45. <!-- <view class="list">
  46. <view class="li ddflex" v-for="(item,index) in personList" :key="index">
  47. <view class="fflex">{{item.name}}</view>
  48. <text>{{item.phone}}</text>
  49. </view>
  50. </view> -->
  51. <view class="ming">
  52. <view class="tits">活动说明</view>
  53. <view class="tips">
  54. <view>1、本活动由主办方处理退款事宜</view>
  55. <view>2、如需退款,请联系团长或客服</view>
  56. </view>
  57. </view>
  58. <view class="bot ddflex">
  59. <block v-if="money > 0">
  60. <view class="heji">合计:<text class="yuan">¥</text><text>{{money}}</text></view>
  61. <view class="btn" @click="createEnlist()">提交报名</view><!-- 原来的方法pay() -->
  62. </block>
  63. <view class="btn fflex" @click="createEnlist()" v-else>提交报名</view>
  64. </view>
  65. </view>
  66. </template>
  67. <script>
  68. const req = require('../../utils/request.js');
  69. const api = require('../../utils/api.js');
  70. const util = require('../../utils/util.js');
  71. const requsetmessage = require('../../utils/requestmessage.js');
  72. const app = getApp();
  73. export default {
  74. components: {
  75. },
  76. data() {
  77. return {
  78. mainStyle: app.globalData.mainStyle,
  79. isShow: false,
  80. options: {},
  81. detail: '',
  82. isAdd: false,
  83. personList: [],
  84. personPramas: [],
  85. money: 0,
  86. userinfovip: {},
  87. price: 0
  88. };
  89. },
  90. onLoad(options) {
  91. this.options = options;
  92. if(req.getStorage('personList')){
  93. let personList = req.getStorage('personList');
  94. let arr = []
  95. personList.map(it=>{
  96. let obj = {
  97. isShowChild: false,
  98. child: it
  99. }
  100. arr.push(obj);
  101. })
  102. this.personList = personList;
  103. this.personPramas = arr;
  104. }
  105. // if(req.getStorage('personPramas')) {
  106. // let personPramas = req.getStorage('personPramas');
  107. // personPramas.map(it=>{
  108. // it.isShowChild = false;
  109. // it.child = it;
  110. // return it;
  111. // })
  112. // this.personPramas = personPramas;
  113. // }
  114. console.log('personList==',this.personList)
  115. },
  116. onShow() {
  117. this.price = req.getStorage('actPrice');
  118. this.getData(false);
  119. // this.money = this.personList.length * this.price;
  120. this.money = this.price;
  121. },
  122. methods: {
  123. showChild(index){
  124. if(this.personPramas[index].isShowChild){
  125. this.personPramas[index].isShowChild = false;
  126. }else{
  127. console.log('未展开')
  128. this.personPramas.map((it,idx)=>{
  129. if(index == idx) it.isShowChild = true;
  130. else it.isShowChild = false;
  131. return it;
  132. })
  133. }
  134. this.$forceUpdate();
  135. },
  136. getTimeText(startTime,endTime,isText){
  137. return util.getTimeText(startTime,endTime,isText);
  138. },
  139. getData(isShow){
  140. let that = this;
  141. return new Promise((resolve,reject)=>{
  142. req.getRequest('/api/match/detail',{id: this.options.id},res => {
  143. that.detail = res;
  144. that.isShow = true;
  145. resolve();
  146. },isShow);
  147. })
  148. },
  149. jumpUrl(url){
  150. uni.navigateTo({
  151. url: url
  152. })
  153. },
  154. async pay(){
  155. let arryNew = [];
  156. this.personList.map((item, index) => {
  157. arryNew.push(Object.assign({}, item, { phone: item.mobile }));
  158. return arryNew;
  159. });
  160. for(let key in arryNew){
  161. delete arryNew[key].mobile;
  162. }
  163. let param = {
  164. // matchId: this.detail.id,
  165. money: this.money,
  166. matchPriceId: this.options.priceId,
  167. list: JSON.stringify(arryNew)
  168. }
  169. if(req.getStorage('scene')) param.scene = req.getStorage('scene');
  170. // #ifdef MP-WEIXIN
  171. await requsetmessage.remindActivity().then(res => {});
  172. // #endif
  173. req.postRequest('api/myMatch/order',param,async res=>{
  174. await this.payOrder(res)
  175. })
  176. },
  177. payOrder(id){
  178. req.payOrders(id,success =>{
  179. let dataP = {
  180. id: this.detail.id
  181. }
  182. uni.$emit( 'em.close.page', dataP);
  183. uni.navigateBack()
  184. // console.log('success==',success)
  185. // uni.navigateBack({
  186. //   delta: 1
  187. // })
  188. // uni.redirectTo({
  189. // url: '/match/success/success?id=' + this.detail.id
  190. // })
  191. })
  192. },
  193. async createEnlist(){
  194. let pa = {
  195. matchId: this.detail.id,
  196. money: this.money,
  197. id: this.options.priceId
  198. }
  199. pa.params = JSON.stringify(this.personList);
  200. // #ifdef MP-WEIXIN
  201. await requsetmessage.remindActivity().then(res => {});
  202. // #endif
  203. req.postRequest(api.enlist_create,pa,async res=>{
  204. this.enlistLaunchCrowd(res);
  205. })
  206. },
  207. enlistLaunchCrowd(enlistId){
  208. let pa = {
  209. enlistId: enlistId,
  210. type: 2
  211. }
  212. req.postRequest(api.enlist_launchCrowd,pa,async data=>{
  213. await this.payOrder(data)
  214. })
  215. },
  216. }
  217. };
  218. </script>
  219. <style>
  220. @import "./signConfirm.css";
  221. </style>