sign.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. <template>
  2. <view>
  3. <view class="top">
  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="sta">
  9. <view class="time ddflex">
  10. <image style="width: 21rpx;height: 21rpx;margin-right: 10rpx;" src="../static/images/time.png"></image>
  11. <text class="flex">{{ detail.enlistStartTime?formatTime(detail.enlistStartTime):'' }}-{{ detail.enlistEndTime?formatTime(detail.enlistEndTime):'' }}</text>
  12. </view>
  13. <view class="time ddflex" style="margin-top: 12rpx;" v-if="detail.address">
  14. <image style="width: 19rpx;height: 24rpx;margin-right: 10rpx;" src="../static/images/area.png"></image>
  15. <text class="flex">{{ detail.address?detail.address:'' }}</text>
  16. </view>
  17. </view>
  18. </view>
  19. </view>
  20. </view>
  21. <view class="info">
  22. <view class="tit ddflex">报名信息<text>{{personList.length}}人</text></view>
  23. <view class="add" @click="addSign()">+ 添加报名人</view>
  24. <view class="list">
  25. <view class="li ddflex" v-for="(item,index) in personList" :key="index" @click="jumpUrl('/match/signPerson/signPerson?index='+(index+1))">
  26. <image src="../../static/pages/images/userimg.png" mode="aspectFill" class="user"></image>
  27. <view class="fflex">{{item.name}}<text>{{item.phone}}</text></view>
  28. <image src="../static/images/jian.png" class="jian" @click="delPerson(index)"></image>
  29. </view>
  30. </view>
  31. </view>
  32. <view class="btn" @click="jumpUrlNext('/match/signConfirm/signConfirm?id=' + detail.id + '&priceId=' + options.priceId)">下一步</view>
  33. <!-- 添加报名信息 -->
  34. <view class="ceng" v-if="isAdd"></view>
  35. <view class="popup" v-if="isAdd">
  36. <view class="tits">姓名</view>
  37. <input placeholder="请输入真实姓名" placeholder-class="placeholder" class="ipt" @input="intName" />
  38. <view class="tits">手机号码</view>
  39. <input placeholder="请输入手机号码" placeholder-class="placeholder" class="ipt" @input="intPhone" />
  40. <view class="pop-btn ddflex">
  41. <view class="cancel" @click="cancel()">取消</view>
  42. <view class="save" @click="save()">保存</view>
  43. </view>
  44. </view>
  45. </view>
  46. </template>
  47. <script>
  48. const req = require('../../utils/request.js');
  49. const api = require('../../utils/api.js');
  50. const util = require('../../utils/util.js');
  51. const app = getApp();
  52. export default {
  53. components: {
  54. },
  55. data() {
  56. return {
  57. isShow: false,
  58. options: {},
  59. detail: {},
  60. isAdd: false,
  61. personList: [],
  62. name: '',
  63. phone: '',
  64. userinfovip: {},
  65. price: 0
  66. };
  67. },
  68. onLoad(options) {
  69. this.options = options;
  70. // if(req.getStorage('personList')){
  71. // this.personList = req.getStorage('personList')
  72. // }
  73. },
  74. onShow() {
  75. this.price = req.getStorage('actPrice');
  76. this.getuserVip();
  77. if(req.getStorage('personList')){
  78. this.personList = req.getStorage('personList')
  79. }
  80. this.getData(true);
  81. },
  82. methods: {
  83. getData(isShow){
  84. req.getRequest('/api/match/detail',{id: this.options.id},res => {
  85. this.detail = res;
  86. this.isShow = true;
  87. },isShow);
  88. },
  89. formatTimeCommStr(dataStr) {
  90. return util.formatTimeCommStr(dataStr, 'M/D');
  91. },
  92. getuserVip() {
  93. req.getRequest('/api/user/levelDetails', {}, data => {
  94. let expireTime = Array;
  95. if (data.expireTime) {
  96. expireTime = data.expireTime.split(" ");
  97. data.expireTime = data.expireTime.replace(/-/g, '/');
  98. } // 解决苹果不兼容---日期
  99. let nowTime = new Date().getTime();
  100. let endTime = new Date(data.expireTime).getTime();
  101. let times = parseInt((endTime - nowTime) / 1000); // var expireTime= new Date(data.expireTime)
  102. // console.log(times, nowTime, endTime, data.expireTime);
  103. this.userinfovip = data;
  104. if (times <= 0) {
  105. this.userinfovip.end = true;
  106. } else {
  107. this.userinfovip.end = false;
  108. }
  109. });
  110. },
  111. toActivity(item){
  112. uni.navigateTo({
  113. url: '/match/activityDetail/activityDetail?id=' + item.id
  114. })
  115. },
  116. choose: function () {
  117. let freshen = false;
  118. this.$emit('freshen', {
  119. detail: freshen
  120. });
  121. },
  122. clickCollect(){
  123. req.postRequest('/api/collect',{
  124. bindId: this.detail.id,
  125. type: 2
  126. },res=>{
  127. this.detail.isCollect = !this.detail.isCollect;
  128. })
  129. },
  130. jumpUrlNext(url){
  131. if(this.personList && this.personList.length < 1) return req.msg('请添加报名人员');
  132. uni.navigateTo({
  133. url: url
  134. })
  135. },
  136. jumpUrl(url){
  137. uni.navigateTo({
  138. url: url
  139. })
  140. },
  141. addSign(){
  142. // this.isAdd = true;
  143. uni.navigateTo({
  144. url: '/match/signPerson/signPerson'
  145. })
  146. },
  147. cancel(){
  148. this.isAdd = false;
  149. },
  150. intName(e) {
  151. this.name = e.detail.value;
  152. },
  153. intPhone(e) {
  154. this.phone = e.detail.value;
  155. },
  156. save(){
  157. if(!this.name) return req.msg('请填写报名人员姓名');
  158. if(!this.phone) return req.msg('请填写报名人员手机号码');
  159. if(!util.isMobile(this.phone)) return req.msg('请填写正确的手机号码')
  160. let personList = this.personList;
  161. let arr = {
  162. name: this.name,
  163. phone: this.phone
  164. }
  165. this.personList = personList.concat(arr);
  166. req.setStorage('personList',this.personList)
  167. this.isAdd = false;
  168. },
  169. delPerson(index){
  170. this.personList.splice(index,1)
  171. req.setStorage('personList',this.personList)
  172. },
  173. formatTime(date){
  174. date = new Date(date.replace(/-/g, '/'))
  175. return util.formatTime(date).t3
  176. }
  177. }
  178. };
  179. </script>
  180. <style>
  181. @import "./sign.css";
  182. </style>