index.vue 41 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463
  1. <template>
  2. <view class="content-wrap bg-color">
  3. <view class="head-wrap">
  4. <view class="content-info ">
  5. <view class="h-bg">
  6. <!-- 轮播图 -->
  7. <u-swiper :circular="true" :list="bannerList" :height="340"></u-swiper>
  8. </view>
  9. <view class="content">
  10. <!-- 通知栏 -->
  11. <view v-if="noticeList.length > 0" class="h-notice-bar">
  12. <scroll-notice :dataList="noticeList" :type="2" :interval="3000" :height="46" :fontSize="12"
  13. color="#666666" @click="handleNoticeClick"></scroll-notice>
  14. </view>
  15. <!-- 个人信息、钱包、商店 -->
  16. <view class="h-content-wrap">
  17. <!-- 欢迎语 -->
  18. <view class="welcome-wrap">
  19. <view class="logo">
  20. <image :src="userInfo.selfPhotoUrl || '/static/me/ud4.png'" mode=""></image>
  21. </view>
  22. <view class="text">
  23. <view class="phone">{{ userInfo.ncikName || '' }}</view>
  24. <!-- <view class="welcome">尊敬的{{ userInfo.ncikName || ''}},下午好~</view>-->
  25. </view>
  26. <view v-if="isShowCoupon" @click="goQrCode" class="arrow-right">
  27. <!-- <image v-if="userInfo.wxQrCode" class="qrcode" :src="userInfo.qrcode" mode=""></image> -->
  28. <!-- <image class="qrcode" src="../../static/index/qrcode.png" mode=""></image>
  29. <view class="h-text">会员码</view> -->
  30. <view class="coupon-wrap">
  31. <!-- <u-icon name="/static/me/u5.png" color="#ffb83d" size="22"></u-icon>-->
  32. <text>邀约有礼</text>
  33. </view>
  34. </view>
  35. </view>
  36. <!-- 余额信息 -->
  37. <!-- <view class="balance-info">-->
  38. <!-- <view @click="gotoRechargeService()" class="balance-amount">-->
  39. <!-- <text class="number" v-if="userInfo.balance">¥{{ userInfo.balance }}</text>-->
  40. <!-- <text class="number" v-else>¥0.00</text>-->
  41. <!-- <view class="">余额</view>-->
  42. <!-- </view>-->
  43. <!-- <view class="score-info">-->
  44. <!-- <text class="number" v-if="userInfo.integral">{{ userInfo.integral }}</text>-->
  45. <!-- <text class="number" v-else>0</text>-->
  46. <!-- <view class="">积分</view>-->
  47. <!-- </view>-->
  48. <!-- <view @click="gotoCoupon()" class="coupon-info">-->
  49. <!-- <text class="number" v-if="userInfo.coupon">{{ userInfo.coupon }}</text>-->
  50. <!-- <text class="number" v-else>0</text>-->
  51. <!-- <view class="">优惠券</view>-->
  52. <!-- </view>-->
  53. <!-- <view class="e-currency-info">-->
  54. <!-- <text class="number" v-if="userInfo.electronicCurrency">{{ userInfo.electronicCurrency }}</text>-->
  55. <!-- <text class="number" v-else>0</text>-->
  56. <!-- <view class="">电子币</view>-->
  57. <!-- </view>-->
  58. <!-- </view>-->
  59. <view class="custom-line"></view>
  60. <view class="store-wrap">
  61. <view class="store-info">
  62. <view class="logo">
  63. <image src="../../static/index/u55.png" mode=""></image>
  64. </view>
  65. <view @click="gotoStoreChoose()" class="store-content">
  66. <view class="h-row">
  67. <view class="store-desc">
  68. <view class="store-name">
  69. <view class="">{{ storeInfo.storeName }}</view>
  70. </view>
  71. </view>
  72. <view class="arrow-right">
  73. <view class="change-store">更换门店</view>
  74. <u-icon name="arrow-right" color="#333" size="16"></u-icon>
  75. </view>
  76. </view>
  77. <view class="h-row">
  78. <text class="address">地址:{{ storeInfo.address }}</text>
  79. <text class="address1">{{ storeInfo.distanceDesc }}</text>
  80. </view>
  81. </view>
  82. </view>
  83. </view>
  84. </view>
  85. <!-- 上次订单 -->
  86. <view class="nav-wrap ">
  87. <view class="upper-order-wrap">
  88. <!-- 左边内容 -->
  89. <view @click="gotoServiceOrder()" class="left-content">
  90. <view class="title">
  91. 当日排队
  92. </view>
  93. <view class="desc">
  94. <!-- 多种服务模式任您选择-->
  95. </view>
  96. <view class="bg-img">
  97. <image src="../../static/index/2.png" mode=""></image>
  98. </view>
  99. </view>
  100. <!-- 右边内容 -->
  101. <view class="right-content" @click="goBookService()">
  102. <view class="title">
  103. 明日预约
  104. </view>
  105. <view class="desc">
  106. <!-- 拼命研发中敬请期待...-->
  107. </view>
  108. <view class="bg-img">
  109. <image src="../../static/index/1.png" mode=""></image>
  110. </view>
  111. </view>
  112. </view>
  113. <!-- 导航菜单 -->
  114. <view class="horizontal-dashed-line"></view>
  115. <view class="menu-tab">
  116. <!-- <view class="button-wrap">-->
  117. <!-- <view @click="gotoComeOrder()" class="btn">-->
  118. <!-- <view class="icon">-->
  119. <!-- <u-icon name="/static/index/u213.png" color="red" size="30"></u-icon>-->
  120. <!-- </view>-->
  121. <!-- <view class="name">-->
  122. <!-- 再来一单-->
  123. <!-- </view>-->
  124. <!-- </view>-->
  125. <!-- </view>-->
  126. <view class="button-wrap">
  127. <view @click="gotoRechargeService()" class="btn">
  128. <view class="icon">
  129. <u-icon name="/static/index/u215.png" color="red" size="30"></u-icon>
  130. </view>
  131. <view class="name">
  132. 储值服务
  133. </view>
  134. </view>
  135. </view>
  136. <!-- <view class="button-wrap">-->
  137. <!-- <view @click="gotoOrder()" class="btn">-->
  138. <!-- <view class="icon">-->
  139. <!-- <u-icon name="/static/index/u217.png" color="red" size="30"></u-icon>-->
  140. <!-- </view>-->
  141. <!-- <view class="name">-->
  142. <!-- 当前订单-->
  143. <!-- </view>-->
  144. <!-- </view>-->
  145. <!-- </view>-->
  146. <view class="button-wrap">
  147. <view @click="gotoReceiveCoupons()" class="btn">
  148. <view class="icon">
  149. <u-icon name="/static/index/u247.png" color="red" size="30"></u-icon>
  150. </view>
  151. <view class="name">
  152. 领券中心
  153. </view>
  154. </view>
  155. </view>
  156. <view class="button-wrap">
  157. <view @click="goRights()" class="btn">
  158. <view class="icon">
  159. <u-icon name="/static/index/equity_card.png" color="red" size="30"></u-icon>
  160. </view>
  161. <view class="name">
  162. 权益卡
  163. </view>
  164. </view>
  165. </view>
  166. <view class="button-wrap">
  167. <view @click="goActivity()" class="btn">
  168. <view class="icon">
  169. <u-icon name="/static/index/huodong.png" color="red" size="30"></u-icon>
  170. </view>
  171. <view class="name">
  172. 活动中心
  173. </view>
  174. </view>
  175. </view>
  176. </view>
  177. </view>
  178. <!-- 为你推荐 -->
  179. <!-- <view class="recommend-wrap">-->
  180. <!-- <view class="recommend-nav">-->
  181. <!-- <view class="icon">-->
  182. <!-- <image src="/static/index/u87.png" mode=""></image>-->
  183. <!-- </view>-->
  184. <!-- <view class="title">-->
  185. <!-- 为你推荐-->
  186. <!-- </view>-->
  187. <!-- </view>-->
  188. <!-- &lt;!&ndash; 分割线 &ndash;&gt;-->
  189. <!-- <view class="custom-line"></view>-->
  190. <!-- &lt;!&ndash; 门店列表 &ndash;&gt;-->
  191. <!-- <view class="store-wrap ">-->
  192. <!-- <view class="store-list">-->
  193. <!-- <view class="store-content">-->
  194. <!-- <view class="store-img">-->
  195. <!-- <image src="../../static/logo.png" mode=""></image>-->
  196. <!-- </view>-->
  197. <!-- <view class="h-store-content">-->
  198. <!-- <view class="title">-->
  199. <!-- <text>{{ storeInfo.storeName }}</text>-->
  200. <!-- </view>-->
  201. <!-- <view class="adress">-->
  202. <!-- 地址:{{ storeInfo.address }}-->
  203. <!-- </view>-->
  204. <!-- <view class="desc">-->
  205. <!-- <view class="price">-->
  206. <!-- </view>-->
  207. <!-- <view @click="gotoGoods()" class="order-btn">-->
  208. <!-- <view class="btn">去下单</view>-->
  209. <!-- </view>-->
  210. <!-- </view>-->
  211. <!-- </view>-->
  212. <!-- </view>-->
  213. <!-- </view>-->
  214. <!-- </view>-->
  215. <!-- </view>-->
  216. <!-- <view class="footer ">-->
  217. <!-- <view class="">-&#45;&#45;到底了-&#45;&#45;</view>-->
  218. <!-- </view>-->
  219. </view>
  220. </view>
  221. </view>
  222. <!-- <view class="tabBarView">-->
  223. <!-- <tab-bar :tabIndex="tabIndex"></tab-bar>-->
  224. <!-- </view>-->
  225. <uni-popup :mask-click="false" ref="strategyListPoup">
  226. <view class="flex-col justify-start expirePopup" style="position: relative;">
  227. <view class="flex-row justify-between" style="position: absolute;top: 20rpx;right: 20rpx"
  228. @click="closeStrategyListPoup">
  229. <u-icon size="20" name="close-circle-fill"></u-icon>
  230. </view>
  231. <view class="flex-row justify-center">
  232. <text class="popupTitle">新人专享</text>
  233. </view>
  234. <scroll-view scroll-y class="flex-col justify-start scroll-y1">
  235. <view class="flex-col">
  236. <u--form
  237. labelPosition="left"
  238. :model="phoneParam"
  239. :rules="rules"
  240. ref="form1"
  241. >
  242. <u-form-item
  243. label="手机号"
  244. prop="phonenumber"
  245. labelWidth="auto"
  246. labelAlign="right"
  247. >
  248. <u--input
  249. v-model="phoneParam.phonenumber"
  250. placeholder="请输入手机号"
  251. border="bottom"
  252. type="number"
  253. maxlength="11"
  254. ></u--input>
  255. </u-form-item>
  256. <u-form-item
  257. labelWidth="auto"
  258. labelAlign="right"
  259. label="验证码"
  260. prop="smsCode"
  261. width="120"
  262. >
  263. <u--input
  264. v-model="phoneParam.smsCode"
  265. disabledColor="#ffffff"
  266. placeholder="请输入验证码"
  267. border="bottom"
  268. maxlength="4"
  269. ></u--input>
  270. <template #right>
  271. <view class="identifying-code">
  272. <u-code
  273. ref="uCode3"
  274. @change="codeChange2"
  275. keep-running
  276. start-text="获取验证码"
  277. ></u-code>
  278. <text
  279. @tap="getCode2"
  280. :text="tips2"
  281. class="u-page__code-text"
  282. >{{ tips2 }}
  283. </text>
  284. </view>
  285. </template>
  286. </u-form-item>
  287. </u--form>
  288. <view class="flex-col justify-start">
  289. <text style="font-size: 28rpx;color: #333333;text-align: center">{{ rule.title }}</text>
  290. </view>
  291. <view class="flex-col " v-for="(item,index) in rule.strategyList" :key="index">
  292. <view class="flex-row justify-start quan " :class="[item.select == 1 ? 'row-list' : 'listBackground']"
  293. @click="selectQuan(item,index)">
  294. <view class=" h-text flex-col justify-center ">
  295. <view class="money">
  296. <text class="money" v-if="item.discountsType == 2">{{ item.discount }}折</text>
  297. <text class="money" v-else>{{ `减` + item.discountsPrice }}</text>
  298. </view>
  299. <view class="desc">
  300. <text>满{{ item.reachPrice }}可用</text>
  301. </view>
  302. </view>
  303. <view class=" h-center-content flex-col justify-around">
  304. <view class="h-value">
  305. <text>{{ item.name }}</text>
  306. </view>
  307. <view>
  308. <view class="title">
  309. 可用次数:{{ item.degree }}
  310. </view>
  311. </view>
  312. <view class="title flex-row">
  313. <text @click="showRemark(item)">使用说明</text>
  314. <u-icon v-if="item.id == showRemarkId" name="arrow-down-fill" color="" size="12"></u-icon>
  315. <u-icon v-else name="play-right-fill" color="" size="12"></u-icon>
  316. </view>
  317. </view>
  318. </view>
  319. <view v-if="showRemarkId == item.id" class="remark" style="text-indent:unset">
  320. <view class="remarkText">
  321. <view>
  322. 可用门店:
  323. <text>{{ item.useStoreDesc }}</text>
  324. </view>
  325. <view>
  326. 适用项目:
  327. <text>{{ item.useServiceDesc }}</text>
  328. </view>
  329. <view v-if="item.remark !=null">
  330. 使用说明:
  331. <text>{{ item.remark }}</text>
  332. </view>
  333. <text v-else class="remarkText">该优惠券暂无使用说明</text>
  334. </view>
  335. </view>
  336. </view>
  337. </view>
  338. </scroll-view>
  339. <view @click="userBindMember" class="op-btn-wrap">
  340. <view class="h-btn">
  341. <text v-if="rule.isAllReceived == 1">全部领取</text>
  342. <text v-else>确定 (可选{{ rule.receivedCount }}张优惠券)</text>
  343. </view>
  344. </view>
  345. </view>
  346. </uni-popup>
  347. </view>
  348. </template>
  349. <script>
  350. import tabBar from "../../components/tabBar/tabBar";
  351. import ScrollNotice from '../../components/scroll-notice/ScrollNotice.vue';
  352. export default {
  353. components: {
  354. ScrollNotice,
  355. tabBar
  356. },
  357. data() {
  358. return {
  359. isShowCoupon: false,
  360. isGetAddress: true, //是否获取到了经纬度
  361. noticeList: [],
  362. notice: '',
  363. userInfo: {},
  364. bannerList: [],
  365. reqParm: {
  366. auth: true,
  367. appid: 46,
  368. telphone: '',
  369. latitude: 26.5737,
  370. longitude: 106.7135,
  371. },
  372. storeList: [],
  373. storeInfo: {},
  374. showRemarkId: '',
  375. rule: [],
  376. tips2: '',
  377. phoneParam: {
  378. phonenumber: '',
  379. smsCode: '',
  380. },
  381. rules: {
  382. phonenumber: [
  383. {
  384. required: true,
  385. min: 11,
  386. max: 11,
  387. message: '请输入11位电话号码',
  388. trigger: ['blur', 'change'],
  389. },
  390. {
  391. // 此为同步验证,可以直接返回true或者false,如果是异步验证,稍微不同,见下方说明
  392. validator: (rule, value, callback) => {
  393. // 调用uView自带的js验证规则,详见:https://www.uviewui.com/js/test.html
  394. return !this.$isDataEmpty(value);
  395. },
  396. message: "请认真填写电话号码",
  397. trigger: ['blur', 'change'],
  398. }
  399. ],
  400. smsCode: {
  401. required: true,
  402. min: 4,
  403. max: 6,
  404. message: '请输入4位验证码',
  405. trigger: ['blur', 'change'],
  406. },
  407. },
  408. myActivityList: [],
  409. };
  410. },
  411. onShow() {
  412. // this.getRuleById()
  413. this.myActivity()
  414. this.updateApp()
  415. this.userInfo = uni.getStorageSync('userInfo');
  416. if (this.userInfo.selfPhoto) {
  417. this.getImgUrlByOssId(this.userInfo.selfPhoto);
  418. }
  419. // 查询门店信息
  420. const data = uni.getStorageSync('storeInfo');
  421. if (!data) {
  422. setTimeout(e => {
  423. console.log('定时器要执行了 isGetAddress =>', this.isGetAddress)
  424. if (this.isGetAddress) {
  425. console.log('定时器执行了isGetAddress =>', this.isGetAddress)
  426. this.isGetAddress = !this.isGetAddress
  427. this.getStoreListData(this.reqParm)
  428. }
  429. }, 3000)
  430. // 获取位置信息查询门店列表数据
  431. this.getLocation();
  432. } else {
  433. this.storeInfo = data;
  434. }
  435. },
  436. onLoad(e) {
  437. //程序启动时自动登录成功时触发的事件
  438. uni.$off('loginSuccess')
  439. uni.$on('loginSuccess', this.getRuleById)
  440. console.log(e)
  441. if (e.shareUserId) {
  442. //用户点击分享到好友或者朋友圈传递过来的参数
  443. uni.setStorageSync('shareUserId', e.shareUserId)
  444. }
  445. if (e.q) {
  446. //用户扫技师端或者拓客端二维码传递过来的参数
  447. const q = decodeURIComponent(e.q)
  448. let a = q.split('?')
  449. let b = a[1].split('&')
  450. let param = {} //技师端分享过来的参数
  451. for (let i = 0; i < b.length; i++) {
  452. param[b[i].split('=')[0]] = b[i].split('=')[1]
  453. }
  454. if (param.expandUserId) { //从拓客端进来的用户
  455. console.log('扫拓客端二维码进入小程序')
  456. uni.setStorageSync('expandParam', param)
  457. } else if (param.scene) {
  458. console.log('扫用户的会员码进入小程序')
  459. uni.setStorageSync('shareUserId', param.scene)
  460. } else if (param.techNo) { //从技师端进来的用户
  461. console.log('扫技师二维码进入小程序')
  462. uni.setStorageSync('promotionParam', param)
  463. uni.removeStorageSync('storeParam');
  464. this.operLog()
  465. } else {
  466. //用户扫门店的二维码进入小程序
  467. uni.setStorageSync('storeParam', param)
  468. uni.removeStorageSync('promotionParam');
  469. }
  470. console.log("用户扫技师端或者拓客端二维码传递过来的参数", param)
  471. }
  472. //公告信息
  473. this.getNoticeListData();
  474. // 获取banner图列表
  475. this.getSlideshowList();
  476. // 用户信息
  477. setTimeout(() => {
  478. this.userInfo = uni.getStorageSync('userInfo');
  479. if (this.userInfo.selfPhoto) {
  480. this.getImgUrlByOssId(this.userInfo.selfPhoto);
  481. }
  482. }, 2000)
  483. },
  484. //分享到朋友圈
  485. onShareTimeline(option) {
  486. return {
  487. title: '娇骄儿造型',
  488. imageUrl: '/static/logo.png',
  489. query: `shareUserId='${this.userInfo.id}`,
  490. success(res) {
  491. uni.showToast({
  492. title: '分享成功'
  493. })
  494. },
  495. fail(res) {
  496. uni.showToast({
  497. title: '分享失败',
  498. icon: 'none'
  499. })
  500. }
  501. };
  502. },
  503. //分享到好友
  504. onShareAppMessage: function (res) {
  505. return {
  506. title: '娇骄儿造型',
  507. imageUrl: '/static/logo.png',
  508. path: `/pages/index/index?shareUserId=${this.userInfo.id}`,
  509. success(res) {
  510. uni.showToast({
  511. title: '分享成功'
  512. })
  513. },
  514. fail(res) {
  515. uni.showToast({
  516. title: '分享失败',
  517. icon: 'none'
  518. })
  519. }
  520. };
  521. },
  522. methods: {
  523. myActivity() {
  524. // this.$api.myActivity({
  525. // pageNum: 1,
  526. // pageSize: 10,
  527. // }).then(res => {
  528. // this.myActivityList = res.data.rows
  529. //
  530. // })
  531. this.$api.myActivityIsShow().then(res =>{
  532. this.isShowCoupon = res.data.data
  533. })
  534. },
  535. closeStrategyListPoup() {
  536. this.$refs.strategyListPoup.close()
  537. //关闭弹窗
  538. console.log('拓客端推广用户绑定失败!')
  539. console.log('+++++++++++++++expandParam+++++++++++++++++++++++', expandParam)
  540. that.$api.addRecordForAttach({
  541. ...expandParam,
  542. isNew: 1,
  543. isBindSuccess: 0,
  544. }).then(res => {
  545. expandParam.isUse = 1
  546. uni.setStorageSync('expandParam', expandParam)
  547. console.log('+++++++++新用户,扫码推广失败记录!++++++++++++++++')
  548. })
  549. // uni.removeStorageSync('expandParam');
  550. },
  551. userBindMember() {
  552. let expandParam = uni.getStorageSync('expandParam')
  553. let that = this
  554. this.$refs.form1.validate().then(res => {
  555. let couponIds = []
  556. for (const strategy of this.rule.strategyList) {
  557. if (strategy.select == 1) {
  558. couponIds.push(strategy.id)
  559. }
  560. }
  561. if (couponIds.length !== this.rule.receivedCount && this.rule.isAllReceived !== 1) {
  562. uni.showToast({
  563. title: '请选择' + this.rule.receivedCount + '张优惠券',
  564. duration: 2000,
  565. icon: "error"
  566. });
  567. return
  568. }
  569. //用户扫码拓客端进入小程序
  570. that.$api.userBindMember(
  571. {
  572. ...expandParam,
  573. memberId: this.userInfo.id,
  574. memberPhone: this.phoneParam.phonenumber,
  575. smsCode: this.phoneParam.smsCode,
  576. couponIds: couponIds
  577. }
  578. ).then(res1 => {
  579. //关闭弹窗
  580. this.$refs.strategyListPoup.close()
  581. uni.showToast({
  582. title: '领取成功',
  583. duration: 2000,
  584. icon: "success"
  585. });
  586. setTimeout(() => {
  587. uni.navigateTo({
  588. url: "/orderPages/myCoupon/index"
  589. })
  590. }, 2000)
  591. console.log('拓客端推广用户绑定成功!')
  592. console.log('+++++++++++++++expandParam+++++++++++++++++++++++', expandParam)
  593. that.$api.addRecordForAttach({
  594. ...expandParam,
  595. isNew: 1,
  596. isBindSuccess: 1,
  597. }).then(res => {
  598. console.log('+++++++++新用户,扫码推广成功记录!++++++++++++++++')
  599. })
  600. expandParam.isUse = 1
  601. uni.setStorageSync('expandParam', expandParam)
  602. // uni.removeStorageSync('expandParam');
  603. })
  604. }).catch(errors => {
  605. console.log(errors)
  606. uni.$u.toast('校验失败,请认真填写')
  607. })
  608. },
  609. codeChange2(text) {
  610. this.tips2 = text;
  611. },
  612. getCode2() {
  613. let that = this;
  614. if (this.$refs.uCode3.canGetCode) {
  615. that.getPhoneCode();
  616. } else {
  617. uni.$u.toast('倒计时结束后再发送');
  618. }
  619. },
  620. // 获取验证码
  621. getPhoneCode() {
  622. let that = this;
  623. // 模拟向后端请求验证码
  624. uni.showLoading({
  625. title: '正在获取验证码'
  626. })
  627. this.$api.getSmsCodeByType({phonenumber: this.phoneParam.phonenumber, auth: true, type: 0}).then((res) => {
  628. uni.hideLoading();
  629. // 这里此提示会被this.start()方法中的提示覆盖
  630. uni.$u.toast('验证码已发送');
  631. // 通知验证码组件内部开始倒计时
  632. that.$refs.uCode3.start();
  633. })
  634. },
  635. showRemark(item) {
  636. if (this.showRemarkId == item.id) {
  637. this.showRemarkId = ''
  638. } else {
  639. this.showRemarkId = item.id
  640. }
  641. },
  642. getRuleById() {
  643. let expandParam = uni.getStorageSync('expandParam')
  644. this.$api.getRuleById({
  645. id: expandParam.ruleId
  646. }).then(res => {
  647. this.rule = res.data.data
  648. if (this.rule.strategyList.length > 0) {
  649. for (const strategy of this.rule.strategyList) {
  650. if (this.rule.isAllReceived == 1) {
  651. strategy.select = 1
  652. } else {
  653. strategy.select = 0
  654. }
  655. }
  656. this.$refs.strategyListPoup.open()
  657. }
  658. })
  659. },
  660. selectQuan(item, index) {
  661. if (this.rule.isAllReceived == 1) {
  662. return
  663. }
  664. console.log(item)
  665. item.select = item.select ? 0 : 1
  666. this.$set(this.rule.strategyList, index, item)
  667. },
  668. operLog() {
  669. let param = uni.getStorageSync('promotionParam')
  670. let userInfo = uni.getStorageSync('userInfo')
  671. // #ifdef MP-WEIXIN
  672. const accountInfo = wx.getAccountInfoSync();
  673. console.log(accountInfo.miniProgram.version, '小程序版本号')
  674. // #endif
  675. const data = {
  676. title: "小程序扫码记录",
  677. operParam: param.techNo,
  678. operName: userInfo.no,
  679. deptName: param.storeId,
  680. errorMsg: accountInfo.miniProgram.version
  681. }
  682. console.log(data)
  683. this.$api.scanLogs(data).then(res => {
  684. console.log('------日志发送成功---------')
  685. }).catch(errors => {
  686. console.log(errors, '------日志发送失败---------')
  687. })
  688. },
  689. goQrCode() {
  690. uni.navigateTo({
  691. // url: '/pages/qrCode/index'
  692. url: '/myPages/myActivity/myActivity'
  693. })
  694. },
  695. goActivity() {
  696. uni.navigateTo({
  697. url: '/orderPages/activityList/activityList'
  698. })
  699. },
  700. goRights() {
  701. uni.navigateTo({
  702. url: '/storePages/rights/index'
  703. })
  704. },
  705. // 去服务点单页面
  706. gotoServiceOrder() {
  707. uni.navigateTo({
  708. url: '/orderPages/storeService/index'
  709. })
  710. },
  711. goBookService() {
  712. uni.navigateTo({
  713. url: '/orderPages/bookService/index'
  714. })
  715. },
  716. //点击通知
  717. handleNoticeClick(e) {
  718. console.log(e)
  719. uni.navigateTo({
  720. url: '/storePages/notice/index?noticeId=' + e.noticeId,
  721. })
  722. },
  723. // 去优惠劵大厅
  724. gotoReceiveCoupons() {
  725. uni.navigateTo({
  726. url: '/orderPages/receiveCoupons/index'
  727. })
  728. },
  729. // 去我的优惠劵页面
  730. gotoCoupon() {
  731. uni.navigateTo({
  732. url: '/orderPages/myCoupon/index'
  733. })
  734. },
  735. // 储值服务
  736. gotoRechargeService() {
  737. uni.navigateTo({
  738. url: '/myPages/recharge/index?name=lisa',
  739. })
  740. },
  741. // 获取banner图片
  742. getSlideshowList() {
  743. let that = this;
  744. this.$api.getSlideshowList({
  745. data: this.reqParm
  746. }).then((res) => {
  747. this.getImgUrlByBannerOssId(res.data.data);
  748. })
  749. },
  750. async getImgUrlByBannerOssId(items) {
  751. for (let i = 0; i < items.length; i++) {
  752. if (items[i].slideshowId) {
  753. this.$api.getImage(items[i].slideshowId).then(res => {
  754. this.bannerList.push(res.data.data[0].url.replace(/^http:/, "https:"))
  755. })
  756. }
  757. }
  758. },
  759. // 获取门店列表数据
  760. getStoreListData(data) {
  761. let that = this;
  762. // 用户绑定门店
  763. this.$api.storeList(data).then((res) => {
  764. console.log(res.data.data[0])
  765. that.storeInfo = res.data.data[0]
  766. // 更新用户选择的门店信息
  767. uni.setStorageSync('storeInfo', res.data.data[0])
  768. })
  769. },
  770. getNoticeListData() {
  771. let req = {
  772. auth: true,
  773. noticeType: 2,
  774. status: 0
  775. }
  776. this.$api.noticeList(req).then((res) => {
  777. if (res.data.rows.length === 1) {
  778. this.noticeList.push(res.data.rows[0])
  779. this.noticeList.push(res.data.rows[0])
  780. } else {
  781. this.noticeList = res.data.rows;
  782. }
  783. })
  784. },
  785. getImgUrlByOssId(ossId) {
  786. if (ossId) {
  787. this.$api.getImage(ossId).then(res => {
  788. this.userInfo.selfPhotoUrl = res.data.data[0].url.replace(/^http:/, "https:")
  789. this.$set(this.userInfo)
  790. })
  791. }
  792. },
  793. // 获取经纬度信息f
  794. getLocation() {
  795. let that = this
  796. console.log('+++++++++++++开始获取位置信息++++++++++++++++')
  797. uni.getLocation({
  798. type: 'gcj02',
  799. success: function (res) {
  800. console.log(res)
  801. let latitude = res.latitude; // 纬度
  802. let longitude = res.longitude; // 经度
  803. let speed = res.speed; // 速度
  804. let accuracy = res.accuracy; // 精确度
  805. // 在这里可以对位置信息进行处理
  806. console.log("纬度:" + latitude + ";经度" + longitude)
  807. that.reqParm.latitude = latitude
  808. that.reqParm.longitude = longitude
  809. uni.setStorageSync('location', that.reqParm)
  810. },
  811. fail: function (fail) {
  812. console.log('获取用户地址失败==》', fail)
  813. },
  814. complete: function (complete) {
  815. console.log('获取用户地址失败or成功==》', complete)
  816. if (that.isGetAddress) {
  817. console.log("根据位置获取门店执行了 isGetAddress =>", that.isGetAddress)
  818. that.isGetAddress = !that.isGetAddress
  819. that.getStoreListData(that.reqParm)
  820. }
  821. }
  822. });
  823. },
  824. // 去选择门店
  825. gotoStoreChoose() {
  826. uni.navigateTo({
  827. url: '/storePages/store/store-choose?type=1',
  828. })
  829. },
  830. // 去再来一单
  831. gotoComeOrder() {
  832. uni.$u.route({
  833. url: '/pages/index/tabbar',
  834. params: {
  835. PageCur: 'orderList',
  836. status: '4'
  837. }
  838. })
  839. },
  840. // 去订单页面
  841. gotoOrder() {
  842. uni.setStorageSync('orderListIndex', 1)
  843. uni.switchTab({
  844. url: '/pages/order/index',
  845. })
  846. },
  847. // 去商品下单页面
  848. gotoGoods() {
  849. uni.navigateTo({
  850. url: '/orderPages/bookService/index',
  851. })
  852. },
  853. // 用户绑定门店
  854. userBindStore() {
  855. let that = this;
  856. // 用户绑定门店
  857. this.$api.userBindStore(this.reqParm).then((res) => {
  858. console.log(this.reqParm)
  859. })
  860. },
  861. updateApp() {
  862. const updateManager = uni.getUpdateManager();
  863. updateManager.onCheckForUpdate(function (res) {
  864. // 请求完新版本信息的回调
  865. console.log('++++++++++onCheckForUpdate++++++++++', res.hasUpdate);
  866. if (res.hasUpdate) {
  867. updateManager.onUpdateReady(function (res) {
  868. console.log('+++++++++onUpdateReady+++++++++++++', res)
  869. uni.showModal({
  870. title: '更新提示',
  871. content: '新版本已经准备好,是否重启应用?',
  872. showCancel: false,
  873. success(res) {
  874. if (res.confirm) {
  875. // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
  876. updateManager.applyUpdate();
  877. }
  878. }
  879. });
  880. });
  881. updateManager.onUpdateFailed(function (res) {
  882. // 新的版本下载失败
  883. console.log('+++++++++onUpdateFailed+++++++++++++', res)
  884. uni.showModal({
  885. title: '更新提示',
  886. content: '检测到小程序更新,但是下载失败,请检查网络',
  887. showCancel: false
  888. });
  889. });
  890. }
  891. });
  892. },
  893. }
  894. };
  895. </script>
  896. <style scoped lang="scss">
  897. @import "index.rpx.css";
  898. /* 头部内容 */
  899. .head-wrap {
  900. height: 100vh;
  901. background: #FFE05C;
  902. overflow: auto;
  903. .content-info {
  904. position: relative;
  905. .h-bg {
  906. height: 680rpx;
  907. }
  908. .content {
  909. position: absolute;
  910. top: 460rpx;
  911. left: 24rpx;
  912. right: 24rpx;
  913. border-radius: 12rpx;
  914. padding-bottom: 40rpx;
  915. .h-notice-bar {
  916. padding-left: 20rpx;
  917. background: #FFFFFF;
  918. box-shadow: 0rpx 8rpx 16rpx 0rpx rgba(237, 86, 159, 0.05);
  919. border-radius: 20rpx;
  920. }
  921. .noticeCard {
  922. margin-top: 10rpx;
  923. padding: 10rpx;
  924. background: #FFFFFF;
  925. box-shadow: 0rpx 8rpx 16rpx 0rpx rgba(237, 86, 159, 0.05);
  926. border-radius: 10px;
  927. }
  928. .h-content-wrap {
  929. background: #fff;
  930. border-radius: 10px;
  931. /* 欢迎语 */
  932. .welcome-wrap {
  933. padding-top: 12px;
  934. display: flex;
  935. margin-left: 12px;
  936. margin-right: 12px;
  937. margin-top: 16px;
  938. align-items: center;
  939. .logo {
  940. width: 13%;
  941. image {
  942. border-radius: 18px;
  943. width: 36px;
  944. height: 36px;
  945. }
  946. }
  947. .text {
  948. width: 60%;
  949. font-size: 14px;
  950. .welcome-wrap {
  951. font-size: 12px;
  952. color: #999999;
  953. }
  954. .welcome {
  955. font-size: 12px;
  956. color: #999999;
  957. }
  958. }
  959. .arrow-right {
  960. width: 30%;
  961. text-align: center;
  962. cursor: pointer;
  963. display: flex;
  964. justify-content: center;
  965. background: #fff8db;
  966. // background: red;
  967. height: 32px;
  968. align-items: center;
  969. border-radius: 16px;
  970. .qrcode {
  971. height: 20px;
  972. width: 20px;
  973. }
  974. .h-text {
  975. font-size: 12px;
  976. color: #999999;
  977. }
  978. .coupon-wrap {
  979. display: flex;
  980. font-size: 14px;
  981. align-items: center;
  982. }
  983. }
  984. }
  985. /* 钱包信息 */
  986. .balance-info {
  987. font-size: 12px;
  988. padding-left: 12px;
  989. margin-bottom: 16px;
  990. margin-top: 12px;
  991. color: #666;
  992. display: flex;
  993. justify-content: space-around;
  994. text-align: center;
  995. .balance-amount {
  996. padding-right: 4px;
  997. }
  998. .score-info {
  999. padding-right: 4px;
  1000. }
  1001. .coupon-info {
  1002. padding-right: 4px;
  1003. }
  1004. .e-currency-info {
  1005. padding-right: 4px;
  1006. }
  1007. .number {
  1008. color: #333333;
  1009. font-size: 14px;
  1010. }
  1011. }
  1012. /* 商店信息 */
  1013. .store-wrap {
  1014. margin: 10px;
  1015. .store-info {
  1016. display: flex;
  1017. .logo {
  1018. width: 10%;
  1019. text-align: center;
  1020. display: flex;
  1021. justify-content: center;
  1022. align-items: center;
  1023. image {
  1024. width: 30px;
  1025. height: 30px;
  1026. }
  1027. }
  1028. .store-content {
  1029. width: 90%;
  1030. padding-bottom: 13px;
  1031. .h-row {
  1032. display: flex;
  1033. align-items: center;
  1034. justify-content: space-between;
  1035. .store-desc {
  1036. width: 90%;
  1037. display: flex;
  1038. line-height: 30px;
  1039. font-size: 14px;
  1040. .store-name {
  1041. }
  1042. }
  1043. .arrow-right {
  1044. text-align: right;
  1045. margin: 0 auto;
  1046. cursor: pointer;
  1047. padding-top: 3px;
  1048. width: 100px;
  1049. display: flex;
  1050. font-size: 14px;
  1051. .change-store {
  1052. text-align: right;
  1053. color: #666;
  1054. }
  1055. image {
  1056. width: 18px;
  1057. height: 18px;
  1058. }
  1059. }
  1060. .address {
  1061. width: 400rpx;
  1062. color: #999999;
  1063. font-size: 12px;
  1064. padding-right: 12px;
  1065. }
  1066. .address1 {
  1067. color: #999999;
  1068. font-size: 12px;
  1069. padding-right: 12px;
  1070. }
  1071. }
  1072. }
  1073. }
  1074. .adress {
  1075. font-size: 22rpx;
  1076. white-space: nowrap;
  1077. overflow: hidden;
  1078. text-overflow: ellipsis;
  1079. padding-left: 80rpx;
  1080. color: #666;
  1081. }
  1082. }
  1083. }
  1084. }
  1085. }
  1086. }
  1087. /* 上次订单 */
  1088. .nav-wrap {
  1089. background: #fff;
  1090. border-radius: 8px;
  1091. margin-top: 16px;
  1092. .upper-order-wrap {
  1093. display: flex;
  1094. border-radius: 6px;
  1095. justify-content: center;
  1096. .left-content {
  1097. margin-top: 20px;
  1098. width: 50%;
  1099. font-size: 12px;
  1100. text-align: center;
  1101. border-radius: 10px;
  1102. .title {
  1103. font-size: 18px;
  1104. text-align: center;
  1105. }
  1106. .desc {
  1107. padding-top: 6px;
  1108. color: #999999;
  1109. }
  1110. .bg-img {
  1111. text-align: center;
  1112. height: 100px;
  1113. display: flex;
  1114. justify-content: center;
  1115. align-items: center;
  1116. image {
  1117. width: 78px;
  1118. height: 78px;
  1119. }
  1120. }
  1121. }
  1122. .right-content {
  1123. margin-top: 20px;
  1124. width: 50%;
  1125. font-size: 12px;
  1126. text-align: center;
  1127. .title {
  1128. font-size: 18px;
  1129. text-align: center;
  1130. }
  1131. .desc {
  1132. padding-top: 6px;
  1133. color: #999999;
  1134. }
  1135. .bg-img {
  1136. height: 100px;
  1137. text-align: center;
  1138. display: flex;
  1139. justify-content: center;
  1140. align-items: center;
  1141. image {
  1142. width: 78px;
  1143. height: 78px;
  1144. }
  1145. }
  1146. }
  1147. }
  1148. .menu-tab {
  1149. display: flex;
  1150. justify-content: space-around; // 平均分布
  1151. justify-content: center;
  1152. padding-bottom: 8px;
  1153. .button-wrap {
  1154. flex: 1;
  1155. display: flex;
  1156. align-items: center;
  1157. justify-content: center;
  1158. margin-top: 16px;
  1159. margin-bottom: 18px;
  1160. .name {
  1161. padding-top: 3px;
  1162. font-size: 12px;
  1163. color: #666666;
  1164. }
  1165. .btn {
  1166. padding-left: 12px;
  1167. padding-right: 12px;
  1168. height: 36px;
  1169. border-radius: 18px;
  1170. .icon {
  1171. display: flex;
  1172. padding-right: 6px;
  1173. align-items: center;
  1174. justify-content: center;
  1175. image {
  1176. height: 14px;
  1177. width: 14px;
  1178. }
  1179. }
  1180. }
  1181. }
  1182. }
  1183. }
  1184. /* 为你推荐 */
  1185. .recommend-wrap {
  1186. margin-top: 16px;
  1187. background: #fff;
  1188. border-radius: 8px;
  1189. .recommend-nav {
  1190. display: flex;
  1191. margin-left: 12px;
  1192. padding-top: 8px;
  1193. padding-bottom: 4px;
  1194. align-items: center;
  1195. .icon {
  1196. padding-right: 4px;
  1197. image {
  1198. height: 26px;
  1199. width: 26px;
  1200. }
  1201. }
  1202. .title {
  1203. font-size: 16px;
  1204. }
  1205. }
  1206. /* 门店列表 */
  1207. .store-wrap {
  1208. margin: 12px;
  1209. height: 100px;
  1210. .store-list {
  1211. margin-top: 16px;
  1212. .store-content {
  1213. display: flex;
  1214. .store-img {
  1215. width: 30%;
  1216. image {
  1217. width: 100%;
  1218. height: 78px;
  1219. border-radius: 6px;
  1220. }
  1221. }
  1222. .h-store-content {
  1223. width: 70%;
  1224. padding-left: 8px;
  1225. padding-top: 4px;
  1226. .title {
  1227. font-size: 18px;
  1228. font-family: "黑体", sans-serif;
  1229. }
  1230. .adress {
  1231. font-size: 28rpx;
  1232. line-height: 36rpx;
  1233. -webkit-box-orient: vertical;
  1234. -webkit-line-clamp: 1;
  1235. white-space: nowrap;
  1236. overflow: hidden;
  1237. text-overflow: ellipsis;
  1238. color: #666;
  1239. }
  1240. .price {
  1241. color: #666;
  1242. width: 60%;
  1243. font-size: 14px;
  1244. line-height: 22px;
  1245. .red {
  1246. color: red;
  1247. font-size: 16px;
  1248. }
  1249. }
  1250. .desc {
  1251. display: flex;
  1252. padding-top: 3px;
  1253. .price {
  1254. width: 60%;
  1255. font-size: 14px;
  1256. line-height: 22px;
  1257. }
  1258. .order-btn {
  1259. width: 100%;
  1260. .btn {
  1261. background: #FFE05C;
  1262. text-align: center;
  1263. border-radius: 14px;
  1264. height: 26px;
  1265. line-height: 26px;
  1266. color: #333;
  1267. font-size: 12px;
  1268. }
  1269. }
  1270. }
  1271. }
  1272. }
  1273. }
  1274. }
  1275. }
  1276. /* 底部 */
  1277. .footer {
  1278. margin-top: 30px;
  1279. height: 60px;
  1280. font-size: 12px;
  1281. text-align: center;
  1282. color: #666;
  1283. margin-bottom: 40px;
  1284. background-color: #FFE05C;
  1285. }
  1286. .tabBarView {
  1287. position: fixed;
  1288. bottom: 0;
  1289. }
  1290. </style>