index.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. <template>
  2. <view>
  3. <view class="banner">
  4. <image :src="params.pic" mode="widthFix"></image>
  5. </view>
  6. <view class="con">
  7. <block v-for="(it,index) in params.images" :key="index">
  8. <image :src="it" mode="widthFix"></image>
  9. </block>
  10. </view>
  11. <!-- <view class="pro" v-if="params.fieldValues&&params.fieldValues.product">
  12. <view class="title">专项技术产品</view>
  13. <swiper autoplay :easing-function="easeInOutCubic" @change="changeSwiper" class="pro-list">
  14. <swiper-item v-for="(item,index) in JSON.parse(params.fieldValues.product)" :key="index">
  15. <image :src="item.proPic" mode="aspectFill"></image>
  16. <view class="pro-tit tover">{{item.proTitle}}</view>
  17. <view class="pro-bri tovers">{{item.brief}}</view>
  18. </swiper-item>
  19. </swiper>
  20. <view class="pro-dot ddflex"><view :class="'dot' + (swiperCurrent == index ? ' active':'')" v-for="(it,index) in JSON.parse(params.fieldValues.product)" :key="index"></view></view>
  21. </view> -->
  22. <view class="act" v-if="matchList&&matchList.length>0">
  23. <view class="title">活动中心</view>
  24. <view class="act-list" v-for="(item,index) in matchList" :key="index">
  25. <view class="act-info ddflex">
  26. <image :src="item.pic" mode="aspectFill" class="act-img"></image>
  27. <view class="fflex">
  28. <view class="act-tit tovers">{{item.title}}</view>
  29. <view class="tag ddflex">
  30. <text>申请享优惠</text>
  31. </view>
  32. <view class="ddflex">
  33. <view class="area fflex tover">
  34. <text>{{captureTime(item.endTime,false)}} 结束</text>
  35. </view>
  36. <view class="money"><text v-if="item.money">¥</text>{{item.money ? item.money : '免费'}}</view>
  37. </view>
  38. </view>
  39. </view>
  40. <view class="stas ddflex">
  41. <view class="tag-box ddflex fflex">
  42. {{item.brief}}
  43. </view>
  44. <view class="act-btn" @click="toActivity(item)">立即报名</view>
  45. </view>
  46. </view>
  47. </view>
  48. <view class="form">
  49. <view class="form-tag">长沙专享</view>
  50. <view class="form-tit"><view>获取一对一定制维修及报价</view></view>
  51. <view class="form-person ddflex">已提交<text>80</text>人</view>
  52. <view class="li">
  53. <view class="label">您的姓名</view>
  54. <input v-model="name" placeholder="请输入" placeholder-class="placeholder" class="form-ipt" />
  55. </view>
  56. <view class="li">
  57. <view class="label">您的电话</view>
  58. <input v-model="phone" placeholder="请输入" placeholder-class="placeholder" class="form-ipt" v-if="phone" />
  59. <button hover-class="none" open-type="getPhoneNumber" @getphonenumber="getphonenumber" class="phone-btn" v-else>请输入</button>
  60. </view>
  61. <view class="li">
  62. <view class="label">汽车问题</view>
  63. <input v-model="question" placeholder="请输入" placeholder-class="placeholder" class="form-ipt" />
  64. </view>
  65. <view class="form-tip ddflex"><image src="../static/images/liwu.png"></image>每天前<text>10</text>名有好礼</view>
  66. <view class="form-btn" @click="submit">马上索取维修方案及报价</view>
  67. </view>
  68. </view>
  69. </template>
  70. <script>
  71. const app = getApp();
  72. const req = require('../../utils/request.js');
  73. const api = require('../../utils/api.js');
  74. const util = require('../../utils/util.js');
  75. export default {
  76. data() {
  77. return {
  78. sessionKey: '',
  79. userInfo: '',
  80. swiperCurrent: 0,
  81. params: {},
  82. matchList: [],
  83. name: '',
  84. phone: '',
  85. question: ''
  86. };
  87. },
  88. onLoad: async function(options) {
  89. let _ts = this;
  90. app.globalData.getCheckSessoin(json => {
  91. _ts.sessionKey = json.session_key;
  92. });
  93. this.getList();
  94. this.getMatchList();
  95. req.silenceLogin(options.userId, '');
  96. },
  97. onShow(){
  98. let userInfo = req.getStorage('userInfo');
  99. if(userInfo){
  100. this.name = userInfo.realName ? userInfo.realName : userInfo.nickName;
  101. console.log('phone==',userInfo.mobile)
  102. this.phone = userInfo.mobile;
  103. }
  104. },
  105. onShareAppMessage() {
  106. return {
  107. title: this.detaile.title,
  108. imageUrl: this.detaile.pic,
  109. path: '/topic/promotion/index?id=' + this.id +'&isShare=' + true + '&userId=' + req.getStorage('userInfo').id
  110. };
  111. },
  112. onShareTimeline() {
  113. let query = {
  114. id: this.id,
  115. isShare: true,
  116. isShareTimeline: true,
  117. userId: req.getStorage('userInfo').id
  118. }
  119. return {
  120. title: this.detaile.title,
  121. imageUrl: this.detaile.pic,
  122. query: query
  123. };
  124. },
  125. methods: {
  126. changeSwiper(e){
  127. this.swiperCurrent = e.detail.current
  128. },
  129. getList(){
  130. req.getRequest('/api/content/list',{code: 'promotion',page: 1,limit: 1},data=>{
  131. this.getData(data[0].id)
  132. })
  133. },
  134. getData(id){
  135. req.getRequest('/api/content/detail',{id: id},data=>{
  136. this.params = data;
  137. })
  138. },
  139. captureTime(time, isTime) {
  140. return util.captureTime(time, isTime);
  141. },
  142. getMatchList(){
  143. req.getRequest('/api/match/list',{page: 1,limit: 1},data=>{
  144. this.matchList = data;
  145. })
  146. },
  147. toActivity(item){
  148. app.globalData.navigateTo('match/activityDetail/activityDetail?id=' + item.id)
  149. },
  150. getphonenumber(event) {
  151. const detail = event.detail;
  152. const _ts = this;
  153. if (!detail || !detail.encryptedData || !detail.iv) return false;
  154. req.postRequest('/api/weixin/mobile', {
  155. encryptedData: detail.encryptedData,
  156. iv: detail.iv,
  157. sessionKey: this.sessionKey
  158. }, res => {
  159. let userInfo = req.getStorage('userInfo');
  160. if(!userInfo.mobile){
  161. userInfo.mobile = res.mobile;
  162. req.setStorage('userInfo', userInfo)
  163. }
  164. this.phone = res.mobile;
  165. });
  166. },
  167. submit(){
  168. if(!this.name) return req.msg('请输入您的姓名');
  169. if(!this.phone) return req.msg('请输入您的电话');
  170. if(!this.question) return req.msg('请输入您的汽车问题');
  171. let params = {
  172. formId: '10007',
  173. }
  174. params.valueList = [
  175. {
  176. fieldId: '26',
  177. fieldName: 'name',
  178. fieldValue: this.name
  179. },
  180. {
  181. fieldId: '27',
  182. fieldName: 'phone',
  183. fieldValue: this.phone
  184. },
  185. {
  186. fieldId: '28',
  187. fieldName: 'question',
  188. fieldValue: this.question
  189. }
  190. ]
  191. req.postRequest('/api/v3/custom/form/submit',params,data=>{
  192. req.alertMsg('您的申请已提交,我们会有专业人员联系您',res=>{
  193. uni.navigateBack()
  194. })
  195. })
  196. }
  197. }
  198. };
  199. </script>
  200. <style>
  201. @import './index.css';
  202. </style>