sign.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  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()" v-if="!this.about.MATCH_ENLIST_PERSON_LIMIT || (this.about.MATCH_ENLIST_PERSON_LIMIT&&personList.length<this.about.MATCH_ENLIST_PERSON_LIMIT)">+ 添加报名人</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)+'&id='+detail.id)">
  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.stop="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. about:{},
  58. isShow: false,
  59. options: {},
  60. detail: {},
  61. isAdd: false,
  62. personList: [],
  63. name: '',
  64. phone: '',
  65. userinfovip: {},
  66. price: 0
  67. };
  68. },
  69. onLoad(options) {
  70. this.options = options;
  71. // if(req.getStorage('personList')){
  72. // this.personList = req.getStorage('personList')
  73. // }
  74. },
  75. onShow() {
  76. this.price = req.getStorage('actPrice');
  77. this.getuserVip();
  78. if(req.getStorage('personList')){
  79. this.personList = req.getStorage('personList')
  80. }
  81. this.getData(true);
  82. this.getConfig()
  83. },
  84. methods: {
  85. getConfig() {
  86. var _this = this;
  87. return new Promise((res, rej) => {
  88. req.g(
  89. '/api/other/config',
  90. data => {
  91. req.setStorage('configRes', JSON.stringify(data));
  92. this.about = data;
  93. res(data);
  94. },
  95. true
  96. );
  97. });
  98. },
  99. getData(isShow){
  100. req.getRequest('/api/match/detail',{id: this.options.id},res => {
  101. this.detail = res;
  102. this.isShow = true;
  103. },isShow);
  104. },
  105. formatTimeCommStr(dataStr) {
  106. return util.formatTimeCommStr(dataStr, 'M/D');
  107. },
  108. getuserVip() {
  109. req.getRequest('/api/user/levelDetails', {}, data => {
  110. let expireTime = Array;
  111. if (data.expireTime) {
  112. expireTime = data.expireTime.split(" ");
  113. data.expireTime = data.expireTime.replace(/-/g, '/');
  114. } // 解决苹果不兼容---日期
  115. let nowTime = new Date().getTime();
  116. let endTime = new Date(data.expireTime).getTime();
  117. let times = parseInt((endTime - nowTime) / 1000); // var expireTime= new Date(data.expireTime)
  118. // console.log(times, nowTime, endTime, data.expireTime);
  119. this.userinfovip = data;
  120. if (times <= 0) {
  121. this.userinfovip.end = true;
  122. } else {
  123. this.userinfovip.end = false;
  124. }
  125. });
  126. },
  127. toActivity(item){
  128. uni.navigateTo({
  129. url: '/match/activityDetail/activityDetail?id=' + item.id
  130. })
  131. },
  132. choose: function () {
  133. let freshen = false;
  134. this.$emit('freshen', {
  135. detail: freshen
  136. });
  137. },
  138. clickCollect(){
  139. req.postRequest('/api/collect',{
  140. bindId: this.detail.id,
  141. type: 2
  142. },res=>{
  143. this.detail.isCollect = !this.detail.isCollect;
  144. })
  145. },
  146. jumpUrlNext(url){
  147. if(this.personList && this.personList.length < 1) return req.msg('请添加报名人员');
  148. uni.navigateTo({
  149. url: url
  150. })
  151. },
  152. jumpUrl(url){
  153. uni.navigateTo({
  154. url: url
  155. })
  156. },
  157. addSign(){
  158. // this.isAdd = true;
  159. uni.navigateTo({
  160. url: '/match/signPerson/signPerson?id='+this.detail.id
  161. })
  162. },
  163. cancel(){
  164. this.isAdd = false;
  165. },
  166. intName(e) {
  167. this.name = e.detail.value;
  168. },
  169. intPhone(e) {
  170. this.phone = e.detail.value;
  171. },
  172. save(){
  173. if(!this.name) return req.msg('请填写报名人员姓名');
  174. if(!this.phone) return req.msg('请填写报名人员手机号码');
  175. if(!util.isMobile(this.phone)) return req.msg('请填写正确的手机号码')
  176. let personList = this.personList;
  177. let arr = {
  178. name: this.name,
  179. phone: this.phone
  180. }
  181. this.personList = personList.concat(arr);
  182. req.setStorage('personList',this.personList)
  183. this.isAdd = false;
  184. },
  185. delPerson(index){
  186. this.personList.splice(index,1)
  187. req.setStorage('personList',this.personList)
  188. },
  189. formatTime(date){
  190. date = new Date(date.replace(/-/g, '/'))
  191. return util.formatTime(date).t3
  192. }
  193. }
  194. };
  195. </script>
  196. <style>
  197. @import "./sign.css";
  198. </style>