index.vue 36 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186
  1. <template>
  2. <view id="topId">
  3. <view :style="'min-height:' + systems.windowHeight +'rpx;'">
  4. <block v-if="jsonContent && jsonContent.length > 0" v-for="(item, index) in jsonContent" :key="index">
  5. <view class="ban" v-if="item.key == 'banner'">
  6. <swiper class="swiper" @change="swiperChange" autoplay="true" interval="5000" duration="300">
  7. <block v-for="(it, idx) in item.value.imageList" :key="idx">
  8. <swiper-item>
  9. <image lazy-load="true" :src="it.src" mode="aspectFill" @click="clickBanner(item)"></image>
  10. </swiper-item>
  11. </block>
  12. </swiper>
  13. <view class="dots ddflex">
  14. <block v-for="(it, idx) in item.value.imageList" :key="idx">
  15. <view :class="['dot', idx == swiperCurrent ? 'active' : '']"></view>
  16. </block>
  17. </view>
  18. </view>
  19. <view class="form" v-if="item.key == 'applicationForm'">
  20. <view class="form-title" v-if="item.value.title.isShow">{{ item.value.title.value }}</view>
  21. <view class="form-list" id="form">
  22. <view class="li ddflex" v-for="(it, idx) in item.value.formItemList" :key="idx">
  23. <!-- <view class="label">{{it.label}}</view> -->
  24. <block v-if="it.type == 1">
  25. <input v-if="it.dataType == 1" v-model="it.fieldValue" :placeholder="'请填写' + it.label"
  26. placeholder-class="placeholder" maxlength="11" class="ipt fflex" />
  27. <input v-else v-model="it.fieldValue" :placeholder="'请填写' + it.label"
  28. placeholder-class="placeholder" class="ipt fflex" />
  29. </block>
  30. <textarea v-model="it.fieldValue" :placeholder="'请填写' + it.label"
  31. placeholder-class="placeholder" class="textarea fflex" v-else-if="it.type == 4"></textarea>
  32. <picker :range="it.option" class="pickers fflex" @change="changeOptions($event, idx)"
  33. v-else-if="it.type == 5">
  34. <view v-if="it.fieldValue">{{ it.fieldValue }}</view>
  35. <view class="placeholder" v-else>请选择{{ it.label }}</view>
  36. </picker>
  37. </view>
  38. </view>
  39. <view class="form-btn view-box" @click="formSubmit(item.value)">{{ item.value.buttonName }}</view>
  40. </view>
  41. <view class="richText" v-if="item.key == 'text'"><rich-text :nodes="item.value.content"></rich-text></view>
  42. <block v-if="item.key == 'product'">
  43. <view class="product" v-if="item.value.layoutNum == 1">
  44. <view class="li ddflex" v-for="(it, idx) in item.value.productList" :key="idx"
  45. @click="jumpUrlProduct('/product/detail/detail?id=' + it.id)" v-if="!it.isFixedNode">
  46. <image :src="it.pic" mode="aspectFill" class="pro-img"></image>
  47. <view class="pro-info fflex">
  48. <view class="pro-name tovers">{{ it.title }}</view>
  49. <view class="pro-bri tover" v-if="it.brief">{{ it.brief }}</view>
  50. <view class="pro-opt ddflex">
  51. <view class="money">
  52. ¥{{ it.minSalePrice }}
  53. <!-- <text>/起</text> -->
  54. </view>
  55. <view class="pro-btn">立即购买</view>
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. <view class="product2 ddflex" v-if="item.value.layoutNum == 2">
  61. <view class="li" v-for="(it, idx) in item.value.productList" :key="idx"
  62. @click="jumpUrlProduct('/product/detail/detail?id=' + it.id)" v-if="!it.isFixedNode">
  63. <image :src="it.pic" mode="aspectFill" class="pro-img"></image>
  64. <view class="pro-info fflex">
  65. <view class="pro-name tovers">{{ it.title }}</view>
  66. <view class="pro-opt ddflex">
  67. <view class="money">
  68. ¥{{ it.minSalePrice }}
  69. <!-- <text>/起</text> -->
  70. </view>
  71. <view class="pro-cart">
  72. <image src="../../static/pages/images/jia.png"></image>
  73. </view>
  74. </view>
  75. </view>
  76. </view>
  77. </view>
  78. <view class="product product3" v-if="item.value.layoutNum == 3">
  79. <scroll-view scroll-x="true">
  80. <view class="li" v-for="(it, idx) in item.value.productList" :key="idx"
  81. @click="jumpUrlProduct('/product/detail/detail?id=' + it.id)" v-if="!it.isFixedNode">
  82. <view class="ddflex">
  83. <image :src="it.pic" mode="aspectFill" class="pro-img"></image>
  84. <view class="pro-info fflex">
  85. <view class="pro-name tovers">{{ it.title }}</view>
  86. <view class="pro-bri tover" v-if="it.brief">{{ it.brief }}</view>
  87. <view class="pro-opt ddflex">
  88. <view class="money">
  89. ¥{{ it.minSalePrice }}
  90. <!-- <text>/起</text> -->
  91. </view>
  92. <view class="pro-btn">立即购买</view>
  93. </view>
  94. </view>
  95. </view>
  96. </view>
  97. </scroll-view>
  98. </view>
  99. </block>
  100. <view class="images" v-if="item.key == 'images'">
  101. <image :src="item.value.src" mode="widthFix"></image>
  102. </view>
  103. <block v-if="item.key == 'customerService'"></block>
  104. <!-- 企微客服 -->
  105. <view class="contact ddflex" @click="customerServiceChat(item.value)" v-if="item.value.type == '1'">
  106. <image src="../../static/pages/images/kfico.png"></image>
  107. 客服
  108. </view>
  109. <!-- 第三方客服 -->
  110. <view class="contact ddflex" @click="jumpHref(item.value)" v-if="item.value.type == '2'">
  111. <image src="../../static/pages/images/kfico.png"></image>
  112. 客服
  113. </view>
  114. <!-- 微信客服、内置客服页面 -->
  115. <view @click="jumpUrlCS()" class="contact ddflex" v-if="item.value.type == '0' || item.value.type == '3'">
  116. <image src="../../static/pages/images/kfico.png"></image>
  117. 客服
  118. </view>
  119. <view class="coupon" v-if="item.key == 'coupon'">
  120. <!-- <view class="tag">免费领取</view> -->
  121. <view class="form-title">
  122. <view>
  123. <text>{{ item.value.couponTitle }}</text>
  124. </view>
  125. </view>
  126. <view class="coupon-list">
  127. <view class="li" v-for="(it, indexx) in item.value.couponList" :key="indexx" v-if="!it.isFixedNode">
  128. <view class="info ddflex">
  129. <view class="left-pic">
  130. <image :src="it.couponIcon" mode="aspectFill" v-if="it.couponIcon"></image>
  131. </view>
  132. <view class="fflex">
  133. <view class="title">{{ it.couponTitle }}</view>
  134. <view class="time">{{ getDateFormat(it.couponStart) }}-{{ getDateFormat(it.couponEnd) }}
  135. </view>
  136. </view>
  137. <view class="info-r">
  138. <view class="money">
  139. <text>¥</text>
  140. {{ it.couponAmount }}
  141. </view>
  142. <view class="man">{{ it.couponBrief }}</view>
  143. </view>
  144. </view>
  145. <view class="li-bot ddflex">
  146. <view class="check ddflex fflex" @click.stop="checks(it)">
  147. 查看详情
  148. <image v-if="!it.isShow" src="../../static/pages/images/bico.png"></image>
  149. <image v-else src="../../static/pages/images/bico.png" class="bico_h"></image>
  150. </view>
  151. <!-- <image src="../../static/images/ma_dark.png" class="yong-ma"></image> -->
  152. <block v-if="it.userCount >= it.userReceive && it.userCount != 0 && it.userReceive != -1">
  153. <view class="yong ddflex" @click="jumpUrl('/mine/coupons/coupons')">去使用</view>
  154. </block>
  155. <block v-else>
  156. <view @click="getCoupon(it)" class="yong ddflex"
  157. v-if="item.value.btnBackground.length == 2"
  158. :style="'background: linear-gradient(90deg, ' + item.value.btnBackground[0] + ' 0%, ' + item.value.btnBackground[1] + ' 100%);'">
  159. {{ item.value.buttonName }}
  160. </view>
  161. <view @click="getCoupon(it)" class="yong ddflex"
  162. v-else-if="item.value.btnBackground.length == 1"
  163. :style="'background: ' + item.value.btnBackground[0] + ';'">
  164. {{ item.value.buttonName }}
  165. </view>
  166. <view class="yong ddflex" v-else @click="getCoupon(it)">{{ item.value.buttonName }}
  167. </view>
  168. </block>
  169. </view>
  170. <view class="infos" v-if="it.isShow">
  171. <view>使用范围:{{ it.couponBrief }}</view>
  172. </view>
  173. </view>
  174. </view>
  175. </view>
  176. <view class="coupon coupon-recharge" id="recharge" v-if="item.key == 'recharge'">
  177. <view class="tag">快捷充值</view>
  178. <view class="form-title">
  179. <view>
  180. <text>{{ item.value.rechargeTitle }}</text>
  181. </view>
  182. </view>
  183. <view class="recharge">
  184. <view :class="'dflex rechargeId' + (isInt ? ' on' : '')">
  185. <text v-if="item.value.showSymbol">¥</text>
  186. <input :placeholder="item.value.placeholderText ? item.value.placeholderText : '点击输入充值金额'"
  187. placeholder-class="placeholder" v-model="pay" type="digit" @input="amount" @focus="focus"
  188. @blur="onBlur" />
  189. </view>
  190. <view class="rechargeMoney" v-if="TabList && TabList.length > 0">快捷充值</view>
  191. <view class="rechargeul dflex" v-if="TabList && TabList.length > 0">
  192. <!--选中 加class active -->
  193. <view :class="'rechargeli ' + (it.active ? 'active' : '')" v-for="(it, index) in TabList"
  194. :key="index" @tap="switchTab(it, index)">
  195. <view :class="'wealth ' + (item.active ? 'awealth' : '')">充{{ it.rechargeAmount }}元</view>
  196. <!-- <view class="give awealth">
  197. 送40元
  198. </view> -->
  199. </view>
  200. </view>
  201. </view>
  202. <view class="chongzhi view-box" @click="remainder()"
  203. :style="item.value.mainColor ? 'background-color: ' + item.value.mainColor + ';border: 1px solid ' + item.value.mainColor + ';' : ''">
  204. {{ item.value.buttonName }}
  205. </view>
  206. </view>
  207. <block v-if="item.key == 'fixedNode'">
  208. <block v-if="item.value.type == 'applicationForm' || item.value.type == 'recharge'">
  209. <block v-if="isShowBotFixed">
  210. <view style="height: 140rpx;"></view>
  211. <view class="bot-fixed">
  212. <view :class="'btn'+(item.value.type == 'recharge' ? ' btn-red':'')" @click="anchor(item.value.type == 'applicationForm' ? 'form':'recharge')">{{item.value.contentObj.value.buttonName}}</view>
  213. </view>
  214. </block>
  215. </block>
  216. <block v-if="item.value.type == 'product'">
  217. <view style="height: 160rpx;"></view>
  218. <block v-for="(it, idx) in item.value.contentObj.value.productList" :key="idx">
  219. <view class="product-fixed ddflex" v-if="it.isFixedNode" @click="jumpUrlProduct('/product/detail/detail?id=' + it.id)">
  220. <image :src="it.pic" mode="aspectFill"></image>
  221. <view class="fflex">
  222. <view class="product-tit tover">{{it.title}}</view>
  223. <view class="product-opt ddflex">
  224. <view class="product-price">¥{{ it.minSalePrice }}
  225. <!-- <text>/起</text> -->
  226. </view>
  227. <view class="product-btn">立即购买</view>
  228. </view>
  229. </view>
  230. </view>
  231. </block>
  232. </block>
  233. <block v-if="item.value.type == 'coupon'">
  234. <view style="height: 140rpx;"></view>
  235. <block v-for="(it, idx) in item.value.contentObj.value.couponList" :key="idx">
  236. <view class="coupon-fixed ddflex" v-if="it.isFixedNode">
  237. <image :src="it.couponIcon" mode="aspectFill" v-if="it.couponIcon"></image>
  238. <view class="fflex">
  239. <view class="title tover">{{it.couponTitle}}</view>
  240. <view class="money">
  241. <text>¥</text>
  242. {{ it.couponAmount }}
  243. </view>
  244. </view>
  245. <block v-if="it.userCount >= it.userReceive && it.userCount != 0 && it.userReceive != -1">
  246. <view class="yong ddflex" @click="jumpUrl('/mine/coupons/coupons')">去使用</view>
  247. </block>
  248. <block v-else>
  249. <view @click="getCoupon(it)" class="yong ddflex"
  250. v-if="item.value.contentObj.value.btnBackground.length == 2"
  251. :style="'background: linear-gradient(90deg, ' + item.value.contentObj.value.btnBackground[0] + ' 0%, ' + item.value.contentObj.value.btnBackground[1] + ' 100%);'">
  252. {{ item.value.contentObj.value.buttonName }}
  253. </view>
  254. <view @click="getCoupon(it)" class="yong ddflex"
  255. v-else-if="item.value.contentObj.value.btnBackground.length == 1"
  256. :style="'background: ' + item.value.contentObj.value.btnBackground[0] + ';'">
  257. {{ item.value.contentObj.value.buttonName }}
  258. </view>
  259. <view class="yong ddflex" v-else @click="getCoupon(it)">{{ item.value.contentObj.value.buttonName }}
  260. </view>
  261. </block>
  262. </view>
  263. </block>
  264. </block>
  265. </block>
  266. </block>
  267. <!-- 注册成为会员 -->
  268. <!-- <view class="mask" v-if="isShowBindMobileView" @tap="hintBindMobileView()"></view>
  269. <view class="regi" v-if="isShowBindMobileView">
  270. <view class="regi-tit">{{ isCoupon ? '绑定手机号领取' : '绑定手机号' }}</view>
  271. <view class="phone dflex">
  272. <input v-model="phoneNumberValue" maxlength="11" type="number" placeholder="输入当前使用的手机号" placeholder-class="placeholder" class="flex" />
  273. </view>
  274. <view class="ddflex" style="justify-content: space-between;">
  275. <view class="regi-btn regi-btn1" @click="hintBindMobileView()">取消</view>
  276. <view class="regi-btn" @click="confirmBundMoble()">{{ isCoupon ? '确定领取' : '确定' }}</view>
  277. </view>
  278. </view> -->
  279. <view class="mask" v-if="isShowMask"></view>
  280. <!-- <view class="guide" :style="'top:'+37+'rpx;'">
  281. <view class="guide-tit">点这里更多操作</view>
  282. <view class="guide-tip">领取优惠不迷路</view>
  283. <view class="guide-s ddflex"><image src="../../static/images/cz_jia.png"></image>添加到桌面</view>
  284. <view class="guide-s ddflex"><image src="../../static/images/cz_home.png"></image>返回首页</view>
  285. <view class="guide-btn">我知道了</view>
  286. </view> -->
  287. <view class="popup" v-if="isShowBMDialogView">
  288. <image src="../../static/images/popup_tip.png" class="popup-img"></image>
  289. <view class="popup-tip">提交成功</view>
  290. <view class="popup-tips">你的信息已提交,会有专业人员联系你,请耐心等待</view>
  291. <view class="popup-btns ddflex">
  292. <!-- <view class="back-home ddflex" @click="goHome()">去首页</view> -->
  293. <!-- <view class="check-btn ddflex" @click="hintDialogView()">关闭</view> -->
  294. </view>
  295. <image src="../../static/images/popup_close.png" class="popup-close" @click="hintDialogView()"></image>
  296. </view>
  297. <view class="popup" v-if="isShowRemainderDialogView">
  298. <image src="../../static/images/popup_tip.png" class="popup-img"></image>
  299. <view class="popup-tip">充值成功</view>
  300. <view class="popup-tips">充值已成功,可前往“我的钱包”查看余额</view>
  301. <view class="popup-btns ddflex">
  302. <!-- <view class="back-home ddflex" @click="goHome()">去首页</view> -->
  303. <!-- <view class="check-btn ddflex" @click="jumpUrl('/wallet/index/index')">查看余额</view> -->
  304. <!-- <view class="check-btn ddflex" @click="hintDialogView()">关闭</view> -->
  305. </view>
  306. <image src="../../static/images/popup_close.png" class="popup-close" @click="hintDialogView()"></image>
  307. </view>
  308. <view class="popup" v-if="isShowCouponDialogView">
  309. <image src="../../static/images/popup_tip.png" class="popup-img"></image>
  310. <view class="popup-tip">领取成功</view>
  311. <view class="popup-tips">已存入“我的优惠券”中,可前往查看使用</view>
  312. <view class="popup-btns ddflex">
  313. <!-- <view class="back-home ddflex" @click="jumpUrl('/mine/coupons/coupons')">我的优惠券</view>
  314. <view class="check-btn ddflex" @click="createCode()">立即使用</view> -->
  315. <!-- <view class="check-btn ddflex" @click="hintDialogView()">关闭</view> -->
  316. </view>
  317. <image src="../../static/images/popup_close.png" class="popup-close" @click="hintDialogView()"></image>
  318. </view>
  319. <view class="popup" v-if="isShowBindMobileView">
  320. <view class="popup-tip">验证手机号</view>
  321. <view class="popup-tips">该手机号仅用于线下核销验证请放心填写</view>
  322. <input v-model="phoneNumberValue" maxlength="11" type="number" placeholder="请输入手机号"
  323. placeholder-class="placeholder" class="popup-ipt" @input="phoneNumberInput" />
  324. <view class="yzm-box ddflex" v-if="isPhoneNumber">
  325. <input v-model="verifyCode" type="number" maxlength="6" placeholder="请输入短信验证码"
  326. placeholder-class="placeholder" class="yzm-ipt fflex" />
  327. <view :class="'yzm '+(isGetCodeDisabled?'active':'')" @click="getCode()" v-text="sendMsg"></view>
  328. </view>
  329. <view class="popup-btns ddflex" style="margin-top: 60rpx">
  330. <view class="back-home ddflex" @click="hintBindMobileView()">取消</view>
  331. <view class="check-btn ddflex" @click="confirmBundMoble()">确定</view>
  332. </view>
  333. <image src="../../static/images/popup_close.png" class="popup-close" @click="hintDialogView()"></image>
  334. </view>
  335. <view class="ceng" v-if="isShowCard" @click="hideCardPop"></view>
  336. <view class="qrcode" v-if="isShowCard">
  337. <view class="hintt">{{ currentCard.couponTitle }}</view>
  338. <view class="qr-code ddflex">
  339. <!-- <u-qrcode ref="qrcode" canvas-id="qrcode" :value="currentCard.id" size="200"></u-qrcode> -->
  340. <image class="code-image" :src="currentCard.qrCodeUri"></image>
  341. </view>
  342. <view class="code ddflex">
  343. <text>{{ currentCard.id }}</text>
  344. <view class="copy" @click="copyCode()">复制</view>
  345. </view>
  346. <view class="hittext">- 请将二维码出示给店员核销使用 -</view>
  347. <!-- <view @click="scanCode">扫码</view> -->
  348. <image src="../../static/pages/images/close2.png" class="close" @click="hideCardPop"></image>
  349. </view>
  350. </view>
  351. <!-- <view class="ruzhu ddflex" v-if="ruzhuItem" @click="jumpUrlN('/pages/enter/index?code='+ruzhuItem.code)">
  352. <text>—— 我也要</text>
  353. <text class="rz-text">{{ruzhuItem.title}}</text>
  354. <text>——</text>
  355. </view> -->
  356. <button class="right-share dflex" :class="specClass" open-type="share">
  357. <image src="../../static/images/share1.png"></image>
  358. <view style="text-align: center;">分享</view>
  359. </button>
  360. </view>
  361. </template>
  362. <script>
  363. const app = getApp();
  364. const req = require('../../utils/request.js');
  365. const util = require('../../utils/util.js');
  366. const route = require('../../utils/route.js');
  367. // const sysrequest = require('../../utils/sysrequest.js');
  368. let timer = ''
  369. export default {
  370. data() {
  371. return {
  372. systems: {},
  373. options: {},
  374. params: '',
  375. jsonContent: '',
  376. swiperCurrent: 0,
  377. hideShare: true,
  378. codeUrl: '',
  379. sessionKey: '',
  380. openid: '',
  381. userInfo: {},
  382. isShow: false,
  383. //充值
  384. TabList: [],
  385. money: '',
  386. id: '',
  387. pay: '',
  388. active: false,
  389. isInt: false,
  390. orderId: '',
  391. checkCoupon: '', //选中的优惠券
  392. // isOpenHuaweiMobile: '', //判断是否在华为上使用手机号授权
  393. isHuawei: false,
  394. isShowMask: false,
  395. isShowBMDialogView: false,
  396. isShowBindMobileView: false,
  397. phoneNumberValue: '',
  398. isShowRemainderDialogView: false,
  399. isShowCouponDialogView: false,
  400. isCoupon: false, //是否为优惠券
  401. isRemainder: false, //是否为充值
  402. //使用用券
  403. isShowCard: false,
  404. currentCard: {},
  405. isPhoneNumber: false, //手机号是否有效
  406. isGetCodeDisabled: false,
  407. sendMsg: '获取验证码',
  408. verifyCode: '',
  409. ruzhuItem: '',
  410. isShowBotFixed: true,//是否显示悬浮按钮
  411. windowHeight: '',
  412. specClass: 'hide',
  413. flag: false,
  414. isShowShare: false,
  415. bottomPositon: '-100%',
  416. userInfo:{}
  417. };
  418. },
  419. async onLoad(options) {
  420. this.options = options;
  421. this.id = options.id;
  422. if(options.shareId) req.setStorage('shareId',options.shareId)
  423. await req.silenceLogin(options.userId, '');
  424. setTimeout(()=>{
  425. this.userInfo = req.getStorage('userInfo')
  426. },500)
  427. //缓存商户appid
  428. // var appid = options.appid;
  429. // if (appid) {
  430. // req.setStorageAppId(appid);
  431. // }
  432. // if (options.scene) {
  433. // await this.loadCodeParams();
  434. // }
  435. // this.getAbout();
  436. // this.getSysApply();
  437. await this.getParams();
  438. },
  439. onShow() {
  440. this.userInfo = req.getStorage('userInfo');
  441. if (this.orderId) {
  442. let i = 0;
  443. uni.showLoading({
  444. title: '载入中...'
  445. });
  446. let timer = setInterval(() => {
  447. route.balanceStare({
  448. logsId: this.orderId
  449. },
  450. res => {
  451. if (res.isSuccess || i === 4) {
  452. uni.hideLoading();
  453. this.orderId = '';
  454. this.pay = '';
  455. clearInterval(timer);
  456. if (res.isSuccess) {
  457. this.showRemainderDialogView();
  458. }
  459. } else {
  460. i++;
  461. }
  462. }
  463. );
  464. }, 300);
  465. }
  466. },
  467. onShareAppMessage() {
  468. this.userBehavior(6)
  469. return {
  470. title: this.params.title,
  471. imageUrl: this.params.pic,
  472. path: '/library/pageDetail/index?code=' + this.params.code +'&isShare=' + true+(this.userInfo.userType==1?('&shareId='+this.userInfo.saleNo):'')
  473. };
  474. },
  475. methods: {
  476. // 用户行为
  477. userBehavior(type) {
  478. var dataP = {};
  479. dataP.type =
  480. 7 //、产品 2、活动 3、未知 4、内容 5、课程 6、老师 7、素材 8、题目 9、资料领取 10、招聘职位 12、用户须知 13、素材 15、医院科室 16、海报 20、医生 21 新闻 23名片
  481. dataP.behavior = type; //1、关注 2、收藏 3、点赞 4、浏览 5、确认 6、分享
  482. dataP.bindId = this.params.id;
  483. req.postRequestLoding('/api/v3/behavior/save', dataP, data => {
  484. });
  485. },
  486. goHome() {
  487. this.hintDialogView();
  488. uni.switchTab({
  489. url: '/pages/list/index'
  490. });
  491. },
  492. jumpUrlN(url) {
  493. uni.navigateTo({
  494. url: url
  495. });
  496. },
  497. // getAbout() {
  498. // var _this = this;
  499. // req.getRequest('/api/config', {}, function(res) {
  500. // _this.isOpenHuaweiMobile = res.isOpenHuaweiMobile;
  501. // });
  502. // },
  503. // getSysApply() {
  504. // console.log('》》》》》getSysApply');
  505. // sysrequest.getSysApply(it => {
  506. // this.ruzhuItem = it;
  507. // })
  508. // },
  509. phoneNumberInput(ev) {
  510. if (!this.phoneNumberValue) {
  511. this.isPhoneNumber = false;
  512. return;
  513. }
  514. if (!util.isMobile(this.phoneNumberValue)) {
  515. this.isPhoneNumber = false;
  516. return;
  517. }
  518. this.isPhoneNumber = true;
  519. },
  520. // encrypt(message) {
  521. // var iv = ''; //偏移量
  522. // const keyHex = CryptoJS.enc.Utf8.parse(req.publics.desKey);
  523. // const encrypted = CryptoJS.DES.encrypt(message, keyHex, {
  524. // iv: CryptoJS.enc.Utf8.parse(iv),
  525. // mode: CryptoJS.mode.ECB,
  526. // padding: CryptoJS.pad.Pkcs7
  527. // });
  528. // return encrypted.toString();
  529. // },
  530. // //des解密
  531. // decryptByDESModeEBC(ciphertext) {
  532. // var key = req.publics.desKey;
  533. // var keyHex = CryptoJS.enc.Utf8.parse(key);
  534. // var decrypted = CryptoJS.DES.decrypt(
  535. // {
  536. // ciphertext: CryptoJS.enc.Hex.parse(ciphertext)
  537. // },
  538. // keyHex,
  539. // {
  540. // mode: CryptoJS.mode.ECB,
  541. // padding: CryptoJS.pad.Pkcs7
  542. // }
  543. // );
  544. // console.log('解密转码前》》', decrypted.toString());
  545. // var result_value = decrypted.toString(CryptoJS.enc.Utf8);
  546. // return result_value;
  547. // },
  548. // 余额充值
  549. remainder() {
  550. this.isCoupon = false; //是否为优惠券
  551. this.isRemainder = true; //是否为充值
  552. // #ifdef H5
  553. if (!req.isLogins(false)) {
  554. this.showBindMobileView();
  555. return;
  556. }
  557. // #endif
  558. let that = this;
  559. let from = {};
  560. if (this.pay && this.pay > 0) {
  561. from.money = this.pay;
  562. } else {
  563. return req.msg('输入的充值金额需大于0');
  564. }
  565. route.remainder(from, data => {
  566. that.orderId = data;
  567. if (!data) {
  568. return req.msg('充值下单失败');
  569. } else {
  570. route.balancePay(data, '4', that.pay, res => {
  571. if (res) {}
  572. });
  573. }
  574. });
  575. },
  576. switchTab(item, index) {
  577. this.TabList.map(it => {
  578. it.active = false;
  579. });
  580. this.TabList[index].active = true;
  581. this.pay = item.rechargeAmount;
  582. },
  583. // 输入金额根据输入金额获取赠送多少金额
  584. amount(e) {
  585. console.log('输入框中的金额>>>>', e.detail.value);
  586. let money = e.detail.value;
  587. this.pay = money;
  588. },
  589. focus(e) {
  590. this.isInt = true;
  591. this.TabList.map(it => {
  592. it.active = false;
  593. });
  594. },
  595. onBlur() {
  596. this.isInt = false;
  597. },
  598. getCouponBtnText(item, name) {
  599. return item.userCount >= item.userReceive && item.userCount != 0 && item.userReceive != -1 ? '已领取' :
  600. 'name';
  601. },
  602. showBindMobileView() {
  603. this.isShowMask = true;
  604. this.isShowBindMobileView = true;
  605. },
  606. hintBindMobileView() {
  607. this.isShowMask = false;
  608. this.isShowBindMobileView = false;
  609. },
  610. showRemainderDialogView() {
  611. this.isShowMask = true;
  612. this.isShowRemainderDialogView = true;
  613. },
  614. hintRemainderDialogView() {
  615. this.isShowMask = false;
  616. this.isShowRemainderDialogView = false;
  617. },
  618. showCouponDialogView() {
  619. this.isShowMask = true;
  620. this.isShowCouponDialogView = true;
  621. },
  622. hintCouponDialogView() {
  623. this.isShowMask = false;
  624. this.isShowCouponDialogView = false;
  625. },
  626. showBMDialogView() {
  627. this.isShowMask = true;
  628. this.isShowBMDialogView = true;
  629. },
  630. hintBMDialogView() {
  631. this.isShowMask = false;
  632. this.isShowBMDialogView = false;
  633. },
  634. hintDialogView() {
  635. this.hintRemainderDialogView();
  636. this.hintBindMobileView();
  637. this.hintCouponDialogView();
  638. this.hintBMDialogView();
  639. },
  640. createCode() {
  641. if (this.currentCard) {
  642. this.isShowCard = true;
  643. } else {
  644. this.jumpUrl('/mine/coupons/coupons');
  645. }
  646. this.hintDialogView();
  647. },
  648. hideCardPop() {
  649. this.isShowCard = false;
  650. },
  651. copyCode() {
  652. uni.setClipboardData({
  653. data: this.currentCard.id,
  654. success() {
  655. req.msg('复制成功');
  656. }
  657. });
  658. },
  659. /**
  660. * 确定设置手机号
  661. */
  662. confirmBundMoble() {
  663. if (!this.phoneNumberValue) {
  664. req.msg('请输入手机号');
  665. return;
  666. }
  667. if (!util.isMobile(this.phoneNumberValue)) {
  668. req.msg('请输入11位有效手机号');
  669. return;
  670. }
  671. uni.showLoading({
  672. title: '加载中'
  673. });
  674. this.submitLogin();
  675. this.hintBindMobileView();
  676. },
  677. submitLogin() {
  678. var dataP = {};
  679. var apiUrl = '';
  680. if (!this.phoneNumberValue) {
  681. req.msg('请输入手机号');
  682. return;
  683. }
  684. if (!this.verifyCode) {
  685. req.msg('请输入验证码');
  686. return;
  687. }
  688. dataP = {
  689. mobile: this.phoneNumberValue,
  690. code: this.verifyCode
  691. };
  692. req.postRequest(
  693. '/api/mobileLogin',
  694. dataP,
  695. res => {
  696. this.userInfo = res;
  697. req.setStorage('AUTH_TOKEN', res.token);
  698. req.setStorage('userInfo', res);
  699. req.msg('手机号验证完成');
  700. },
  701. true
  702. );
  703. },
  704. /**
  705. * 手机号登录
  706. * @param {Object} mobile
  707. */
  708. mobleLogin(mobile) {
  709. req.postRequest(
  710. '/api/v3/mobile/noCode/login', {
  711. mobile: mobile
  712. },
  713. res => {
  714. this.userInfo = res;
  715. req.setStorage('AUTH_TOKEN', res.token);
  716. req.setStorage('userInfo', res);
  717. // if (this.isCoupon) {
  718. // this.couponReceive();
  719. // } else {
  720. req.msg('手机号验证完成');
  721. // }
  722. },
  723. true
  724. );
  725. },
  726. /**
  727. * 领取优惠券
  728. * @param {Object} item
  729. */
  730. getCoupon(item) {
  731. console.log('数据>>>>>>>>', item);
  732. this.isCoupon = true; //是否为优惠券
  733. this.isRemainder = false; //是否为充值
  734. this.checkCoupon = item;
  735. //H5单独走逻辑
  736. //判断是否登录
  737. if (!req.isLogins(false)) {
  738. this.showBindMobileView();
  739. return;
  740. }
  741. this.couponReceive();
  742. },
  743. couponReceive() {
  744. var that = this;
  745. if (this.checkCoupon.userReceive > -1 && this.checkCoupon.userCount >= this.checkCoupon.userReceive) {
  746. return req.msg('您已领取过了');
  747. }
  748. req.postRequest(
  749. '/api/coupon/receive', {
  750. id: this.checkCoupon.id
  751. },
  752. res => {
  753. this.currentCard = res;
  754. console.log('领取完成>>>>', this.currentCard);
  755. this.getParams();
  756. this.showCouponDialogView();
  757. },
  758. true
  759. );
  760. },
  761. /**
  762. * 绑定手机号
  763. */
  764. bundMoble(mobile) {
  765. req.postRequest(
  766. '/api/noCode/mobile', {
  767. mobile: mobile
  768. },
  769. res => {
  770. this.isShowBindMobileView = false;
  771. this.userInfo = res;
  772. req.setStorage('userInfo', res);
  773. uni.hideLoading();
  774. this.couponReceive();
  775. },
  776. true
  777. );
  778. },
  779. checks(item, index) {
  780. item.isShow = !item.isShow;
  781. this.$forceUpdate();
  782. },
  783. getParams() {
  784. let that = this;
  785. let params = {
  786. code: this.options.code
  787. };
  788. return new Promise((resolve, reject) => {
  789. req.getRequest(
  790. '/api/material/library/detail',
  791. params,
  792. data => {
  793. data.params.jsonContent.map(item => {
  794. if (item.key == 'applicationForm') {
  795. } else if (item.key == 'recharge') {
  796. //充值
  797. if (item.value.fastRechargeList && item.value.fastRechargeList
  798. .length > 0) {
  799. that.TabList = item.value.fastRechargeList.map(it => {
  800. var itm = {
  801. rechargeAmount: it,
  802. active: false
  803. };
  804. return itm;
  805. });
  806. if (that.TabList && that.TabList.length > 0) {
  807. that.TabList[0].active = true;
  808. that.pay = that.TabList[0].rechargeAmount;
  809. }
  810. console.log('TabList数据====', that.TabList);
  811. }
  812. }
  813. return item;
  814. });
  815. that.params = data;
  816. that.userBehavior(4)
  817. that.jsonContent = data.params.jsonContent;
  818. uni.setNavigationBarTitle({
  819. title: data.title
  820. });
  821. console.log('data.title==', data.title);
  822. resolve();
  823. },
  824. true
  825. );
  826. });
  827. },
  828. swiperChange(e) {
  829. this.swiperCurrent = e.detail.current;
  830. },
  831. jumpUrl(url) {
  832. this.hintDialogView();
  833. if (req.isLogins(true)) {
  834. uni.navigateTo({
  835. url: url
  836. });
  837. }
  838. },
  839. jumpUrlProduct(url) {
  840. if (!req.isLogins(false)) {
  841. this.showBindMobileView();
  842. return;
  843. }
  844. uni.navigateTo({
  845. url: url
  846. });
  847. },
  848. jumpUrlCS() {
  849. uni.navigateTo({
  850. url: '/pages/pageContent/page'
  851. });
  852. },
  853. customerServiceChat(item) {
  854. // #ifdef MP-WEIXIN
  855. wx.openCustomerServiceChat({
  856. extInfo: {
  857. url: item.target
  858. },
  859. corpId: item.id,
  860. success(res) {
  861. console.log('调用微信客服');
  862. },
  863. complete(res) {
  864. console.log('调用企微客服完成');
  865. }
  866. });
  867. // #endif
  868. // #ifdef APP-PLUS
  869. plus.runtime.openURL(item.target, function(res) {});
  870. // #endif
  871. },
  872. jumpHref(item) {
  873. window.location.href = item.target;
  874. },
  875. click(e) {
  876. this.hideShare = e;
  877. },
  878. getCode() {
  879. if (this.isGetCodeDisabled == true) return false;
  880. if (!this.phoneNumberValue) {
  881. req.msg('请输入手机号');
  882. return;
  883. }
  884. if (!util.isMobile(this.phoneNumberValue)) {
  885. req.msg('请输入11位有效手机号');
  886. return;
  887. }
  888. req.postRequest(
  889. '/api/sms/login', {
  890. mobile: this.phoneNumberValue
  891. },
  892. data => {
  893. req.msg('验证码获取成功');
  894. let time = 60;
  895. let interval = setInterval(() => {
  896. time--;
  897. if (time == 0) {
  898. this.isGetCodeDisabled = false;
  899. this.sendMsg = '获取验证码';
  900. clearInterval(interval);
  901. } else {
  902. this.isGetCodeDisabled = true;
  903. this.sendMsg = time + '秒再获取';
  904. }
  905. }, 1000);
  906. },
  907. true
  908. );
  909. },
  910. loadCodeParams() {
  911. let _ts = this;
  912. return new Promise((resolve, reject) => {
  913. let form = {
  914. scene: _ts.options.scene
  915. };
  916. if (!_ts.options.scene) {
  917. resolve();
  918. return false;
  919. }
  920. req.getRequest('/api/code/params', form, data => {
  921. let res = data.scene.split('_');
  922. this.options.code = res[0];
  923. req.setStorage('pidCode', data.userId);
  924. req.silenceLogin(data.userId, '');
  925. resolve();
  926. });
  927. });
  928. },
  929. isInclude(label, keytxt) {
  930. return label.indexOf(keytxt) != -1;
  931. },
  932. getPhoneNumber(e) {
  933. console.log('获取手机号', e);
  934. let that = this;
  935. let _params = {
  936. sessionKey: this.sessionKey,
  937. iv: e.detail.iv,
  938. encryptedData: e.detail.encryptedData
  939. };
  940. if (req.getStorage('pidCode')) {
  941. _params.parentId = req.getStorage('pidCode');
  942. }
  943. if (e.detail.errMsg == 'getPhoneNumber:ok') {
  944. req.postRequest('/api/weixin/mobile', _params, json => {
  945. // console.log(json);
  946. if (json.mobile) {
  947. var userInfo = req.getStorage('userInfo');
  948. userInfo.mobile = json.mobile;
  949. req.setStorage('userInfo', userInfo);
  950. this.phoneNumber = json.mobile;
  951. }
  952. });
  953. }
  954. },
  955. changeOptions(e, idx) {
  956. console.log('选择==', e);
  957. console.log('idx==', idx);
  958. this.jsonContent.map(item => {
  959. if (item.key == 'applicationForm') {
  960. item.value.formItemList.map((it, index) => {
  961. if (it.type == 5 && idx == index) {
  962. it.fieldValue = it.option[e.detail.value];
  963. }
  964. });
  965. }
  966. return item;
  967. });
  968. this.$forceUpdate();
  969. },
  970. checkRequire(formItemList) {
  971. for (var i = 0; i < formItemList.length; i++) {
  972. if (formItemList[i].required) {
  973. //不等于备注,并且为空时返回
  974. if (!this.isInclude(formItemList[i].label, '备注') && !formItemList[i].fieldValue) {
  975. req.msg('请填写' + formItemList[i].label);
  976. return false;
  977. }
  978. if (formItemList[i].type == 1 && this.isInclude(formItemList[i].label, '手机')) {
  979. if (!util.isMobile(formItemList[i].fieldValue)) {
  980. req.msg('请输入11位有效手机号');
  981. return false;
  982. }
  983. }
  984. }
  985. }
  986. return true;
  987. },
  988. /**
  989. * 提交报名表单
  990. * @param {Object} datas
  991. */
  992. formSubmit(datas) {
  993. // if (!req.isLogins(true)) {
  994. // return;
  995. // }
  996. let params = {
  997. formId: datas.database
  998. };
  999. if (req.getStorage('userInfo').id) {
  1000. params.belongUid = req.getStorage('userInfo').id;
  1001. }
  1002. let formItemList = datas.formItemList;
  1003. let valueList = [];
  1004. if (!this.checkRequire(formItemList)) return false;
  1005. formItemList.map(it => {
  1006. let obj = {
  1007. fieldId: it.databaseLabel,
  1008. fieldName: it.label,
  1009. fieldType: it.type,
  1010. fieldValue: it.fieldValue
  1011. };
  1012. valueList.push(obj);
  1013. });
  1014. params.valueList = valueList;
  1015. console.log('表单提交==', params);
  1016. req.postRequest(
  1017. '/api/v3/custom/form/submit',
  1018. params,
  1019. data => {
  1020. this.showBMDialogView();
  1021. },
  1022. true
  1023. );
  1024. },
  1025. callPhone(phone) {
  1026. uni.makePhoneCall({
  1027. phoneNumber: phone
  1028. });
  1029. },
  1030. // 时间格式化
  1031. getDateFormat(date) {
  1032. return util.formatTime(new Date(date)).t3;
  1033. },
  1034. // 锚点
  1035. anchor(id) {
  1036. this.$nextTick(() => {
  1037. setTimeout(() => {
  1038. uni.createSelectorQuery().select('#topId').boundingClientRect(data => {
  1039. uni.createSelectorQuery().select("#" + id).boundingClientRect(res => {
  1040. uni.pageScrollTo({
  1041. duration: 100, //过渡时间
  1042. scrollTop: res.top - data.top - 100, //返回顶部的top值
  1043. success: () => {
  1044. // req.msg("请选择商品")
  1045. }
  1046. })
  1047. }).exec()
  1048. }).exec();
  1049. }, 50)
  1050. })
  1051. },
  1052. showShare(){
  1053. console.log('点击显示分享')
  1054. this.isShowShare = true
  1055. this.bottomPositon = 0
  1056. this.$forceUpdate()
  1057. },
  1058. hideShareFn(){
  1059. this.isShowShare = false
  1060. this.bottomPositon = '-100%'
  1061. },
  1062. },
  1063. mounted() {
  1064. const systemInfo = uni.getSystemInfoSync();
  1065. // px转换到rpx的比例
  1066. let pxToRpxScale = 750 / systemInfo.windowWidth;
  1067. let systems = {
  1068. ktxStatusHeight: systemInfo.statusBarHeight * pxToRpxScale, // 状态栏的高度
  1069. navigationHeight: 44 * pxToRpxScale ,// 导航栏的高度
  1070. windowHeight: (systemInfo.windowHeight * pxToRpxScale - systemInfo.safeAreaInsets.bottom * pxToRpxScale) - 115
  1071. };
  1072. systems.barHeight = systems.ktxStatusHeight + systems.navigationHeight;
  1073. this.systems = systems;
  1074. this.windowHeight = systemInfo.windowHeight;
  1075. },
  1076. onPageScroll(e) {
  1077. var that = this;
  1078. const query = uni.createSelectorQuery().in(this);
  1079. query.selectAll('.' + "view-box").boundingClientRect(data => {
  1080. let a = data
  1081. for (let i = 0; i < a.length; i++) {
  1082. // 判断top数值 向上滑动
  1083. if (a[i].top <= 0) {
  1084. that.isShowBotFixed = true;
  1085. }
  1086. // 向下滑动
  1087. else if (a[i].top > that.windowHeight) {
  1088. that.isShowBotFixed = true;
  1089. }else{
  1090. that.isShowBotFixed = false;
  1091. }
  1092. }
  1093. }).exec();
  1094. if (e.scrollTop > this.myScroll - 2) {
  1095. this.isTop = 1;
  1096. } else {
  1097. this.isTop = 0;
  1098. }
  1099. // 只要滚动就清除状态
  1100. clearTimeout(timer);
  1101. // 告知标识 -> 开始滚动
  1102. this.flag = false;
  1103. this.specClass = 'show';
  1104. // 检测是否停留了 N 秒
  1105. // 如果停留则表示滚动结束
  1106. // N: 500(定时器时间 毫秒) -> 0.5秒算停止滚动
  1107. // 滚动后多长时间算停止滚动
  1108. timer = setTimeout(() => {
  1109. // console.log('结束滚动');
  1110. // 告知标识 -> 结束滚动
  1111. this.flag = true;
  1112. this.specClass = 'hide';
  1113. }, 50);
  1114. },
  1115. };
  1116. </script>
  1117. <style>
  1118. @import './index.css';
  1119. </style>