index.vue 43 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520
  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: false,
  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. const accessToken = uni.getStorageSync('accessToken')
  413. if (accessToken) {
  414. this.myActivity()
  415. }
  416. this.updateApp()
  417. this.userInfo = uni.getStorageSync('userInfo');
  418. if (this.userInfo.selfPhoto) {
  419. this.getImgUrlByOssId(this.userInfo.selfPhoto);
  420. }
  421. // 查询门店信息
  422. const data = uni.getStorageSync('storeInfo');
  423. if (!data) {
  424. setTimeout(e => {
  425. console.log('定时器要执行了 isGetAddress =>', this.isGetAddress)
  426. if (this.isGetAddress) {
  427. console.log('定时器执行了isGetAddress =>', this.isGetAddress)
  428. this.isGetAddress = !this.isGetAddress
  429. this.getStoreListData(this.reqParm)
  430. }
  431. }, 3000)
  432. // 获取位置信息查询门店列表数据
  433. this.getLocation();
  434. } else {
  435. this.storeInfo = data;
  436. }
  437. // 用户主动登录后,处理拓客端扫码逻辑
  438. this.handleExpandParam()
  439. },
  440. onLoad(e) {
  441. //程序启动时自动登录成功时触发的事件
  442. uni.$off('loginSuccess')
  443. uni.$on('loginSuccess', this.getRuleById)
  444. console.log(e)
  445. if (e.shareUserId) {
  446. //用户点击分享到好友或者朋友圈传递过来的参数
  447. uni.setStorageSync('shareUserId', e.shareUserId)
  448. }
  449. if (e.q) {
  450. //用户扫技师端或者拓客端二维码传递过来的参数
  451. const q = decodeURIComponent(e.q)
  452. let a = q.split('?')
  453. let b = a[1].split('&')
  454. let param = {} //技师端分享过来的参数
  455. for (let i = 0; i < b.length; i++) {
  456. param[b[i].split('=')[0]] = b[i].split('=')[1]
  457. }
  458. if (param.expandUserId) { //从拓客端进来的用户
  459. console.log('扫拓客端二维码进入小程序')
  460. uni.setStorageSync('expandParam', param)
  461. } else if (param.scene) {
  462. console.log('扫用户的会员码进入小程序')
  463. uni.setStorageSync('shareUserId', param.scene)
  464. } else if (param.techNo) { //从技师端进来的用户
  465. console.log('扫技师二维码进入小程序')
  466. uni.setStorageSync('promotionParam', param)
  467. uni.removeStorageSync('storeParam');
  468. this.operLog()
  469. } else {
  470. //用户扫门店的二维码进入小程序
  471. uni.setStorageSync('storeParam', param)
  472. uni.removeStorageSync('promotionParam');
  473. }
  474. console.log("用户扫技师端或者拓客端二维码传递过来的参数", param)
  475. }
  476. //公告信息
  477. this.getNoticeListData();
  478. // 获取banner图列表
  479. this.getSlideshowList();
  480. // 用户信息
  481. setTimeout(() => {
  482. this.userInfo = uni.getStorageSync('userInfo');
  483. if (this.userInfo.selfPhoto) {
  484. this.getImgUrlByOssId(this.userInfo.selfPhoto);
  485. }
  486. }, 2000)
  487. },
  488. //分享到朋友圈
  489. onShareTimeline(option) {
  490. return {
  491. title: '娇骄儿造型',
  492. imageUrl: '/static/logo.png',
  493. query: `shareUserId='${this.userInfo.id}`,
  494. success(res) {
  495. uni.showToast({
  496. title: '分享成功'
  497. })
  498. },
  499. fail(res) {
  500. uni.showToast({
  501. title: '分享失败',
  502. icon: 'none'
  503. })
  504. }
  505. };
  506. },
  507. //分享到好友
  508. onShareAppMessage: function (res) {
  509. return {
  510. title: '娇骄儿造型',
  511. imageUrl: '/static/logo.png',
  512. path: `/pages/index/index?shareUserId=${this.userInfo.id}`,
  513. success(res) {
  514. uni.showToast({
  515. title: '分享成功'
  516. })
  517. },
  518. fail(res) {
  519. uni.showToast({
  520. title: '分享失败',
  521. icon: 'none'
  522. })
  523. }
  524. };
  525. },
  526. methods: {
  527. // 处理拓客端扫码逻辑(用户从登录页回来后调用)
  528. handleExpandParam() {
  529. let expandParam = uni.getStorageSync('expandParam')
  530. console.log('========handleExpandParam expandParam=======', expandParam)
  531. if (!expandParam || expandParam.isUse == 1) {
  532. console.log('========handleExpandParam 无参数或已使用,直接返回=======')
  533. return
  534. }
  535. // 检查是否已登录(有 accessToken)
  536. const accessToken = uni.getStorageSync('accessToken')
  537. if (!accessToken) {
  538. console.log('========handleExpandParam 未登录,直接返回=======')
  539. return
  540. }
  541. // 二维码过期检查
  542. if (new Date().getTime() > expandParam.timestamp) {
  543. uni.showModal({
  544. title: '温馨提示',
  545. content: '当前二维码已过期,请重新扫码',
  546. showCancel: false
  547. });
  548. expandParam.isUse = 1
  549. uni.setStorageSync('expandParam', expandParam)
  550. return
  551. }
  552. const isNew = uni.getStorageSync('wxLoginIsNew')
  553. console.log('========handleExpandParam isNew=======', isNew)
  554. if (isNew) {
  555. this.getRuleById()
  556. } else {
  557. this.$api.addRecordForAttach({
  558. ...expandParam,
  559. isNew: 0,
  560. isBindSuccess: 0,
  561. }).then(res => {
  562. expandParam.isUse = 1
  563. uni.setStorageSync('expandParam', expandParam)
  564. console.log('+++++++++老用户,扫码推广失败记录!++++++++++++++++')
  565. })
  566. }
  567. },
  568. myActivity() {
  569. // this.$api.myActivity({
  570. // pageNum: 1,
  571. // pageSize: 10,
  572. // }).then(res => {
  573. // this.myActivityList = res.data.rows
  574. //
  575. // })
  576. this.$api.myActivityIsShow().then(res =>{
  577. this.isShowCoupon = res.data.data
  578. })
  579. },
  580. closeStrategyListPoup() {
  581. this.$refs.strategyListPoup.close()
  582. //关闭弹窗
  583. console.log('拓客端推广用户绑定失败!')
  584. console.log('+++++++++++++++expandParam+++++++++++++++++++++++', expandParam)
  585. that.$api.addRecordForAttach({
  586. ...expandParam,
  587. isNew: 1,
  588. isBindSuccess: 0,
  589. }).then(res => {
  590. expandParam.isUse = 1
  591. uni.setStorageSync('expandParam', expandParam)
  592. console.log('+++++++++新用户,扫码推广失败记录!++++++++++++++++')
  593. })
  594. // uni.removeStorageSync('expandParam');
  595. },
  596. userBindMember() {
  597. let expandParam = uni.getStorageSync('expandParam')
  598. let that = this
  599. this.$refs.form1.validate().then(res => {
  600. let couponIds = []
  601. for (const strategy of this.rule.strategyList) {
  602. if (strategy.select == 1) {
  603. couponIds.push(strategy.id)
  604. }
  605. }
  606. if (couponIds.length !== this.rule.receivedCount && this.rule.isAllReceived !== 1) {
  607. uni.showToast({
  608. title: '请选择' + this.rule.receivedCount + '张优惠券',
  609. duration: 2000,
  610. icon: "error"
  611. });
  612. return
  613. }
  614. //用户扫码拓客端进入小程序
  615. that.$api.userBindMember(
  616. {
  617. ...expandParam,
  618. memberId: this.userInfo.id,
  619. memberPhone: this.phoneParam.phonenumber,
  620. smsCode: this.phoneParam.smsCode,
  621. couponIds: couponIds
  622. }
  623. ).then(res1 => {
  624. //关闭弹窗
  625. this.$refs.strategyListPoup.close()
  626. uni.showToast({
  627. title: '领取成功',
  628. duration: 2000,
  629. icon: "success"
  630. });
  631. setTimeout(() => {
  632. uni.navigateTo({
  633. url: "/orderPages/myCoupon/index"
  634. })
  635. }, 2000)
  636. console.log('拓客端推广用户绑定成功!')
  637. console.log('+++++++++++++++expandParam+++++++++++++++++++++++', expandParam)
  638. that.$api.addRecordForAttach({
  639. ...expandParam,
  640. isNew: 1,
  641. isBindSuccess: 1,
  642. }).then(res => {
  643. console.log('+++++++++新用户,扫码推广成功记录!++++++++++++++++')
  644. })
  645. expandParam.isUse = 1
  646. uni.setStorageSync('expandParam', expandParam)
  647. // uni.removeStorageSync('expandParam');
  648. })
  649. }).catch(errors => {
  650. console.log(errors)
  651. uni.$u.toast('校验失败,请认真填写')
  652. })
  653. },
  654. codeChange2(text) {
  655. this.tips2 = text;
  656. },
  657. getCode2() {
  658. let that = this;
  659. if (this.$refs.uCode3.canGetCode) {
  660. that.getPhoneCode();
  661. } else {
  662. uni.$u.toast('倒计时结束后再发送');
  663. }
  664. },
  665. // 获取验证码
  666. getPhoneCode() {
  667. let that = this;
  668. // 模拟向后端请求验证码
  669. uni.showLoading({
  670. title: '正在获取验证码'
  671. })
  672. this.$api.getSmsCodeByType({phonenumber: this.phoneParam.phonenumber, auth: true, type: 0}).then((res) => {
  673. uni.hideLoading();
  674. // 这里此提示会被this.start()方法中的提示覆盖
  675. uni.$u.toast('验证码已发送');
  676. // 通知验证码组件内部开始倒计时
  677. that.$refs.uCode3.start();
  678. })
  679. },
  680. showRemark(item) {
  681. if (this.showRemarkId == item.id) {
  682. this.showRemarkId = ''
  683. } else {
  684. this.showRemarkId = item.id
  685. }
  686. },
  687. getRuleById() {
  688. let expandParam = uni.getStorageSync('expandParam')
  689. console.log('========getRuleById expandParam=======', expandParam)
  690. console.log('========getRuleById ruleId=======', expandParam.ruleId)
  691. this.$api.getRuleById({
  692. id: expandParam.ruleId
  693. }).then(res => {
  694. console.log('========getRuleById res=======', res)
  695. this.rule = res.data.data
  696. if (this.rule.strategyList && this.rule.strategyList.length > 0) {
  697. for (const strategy of this.rule.strategyList) {
  698. if (this.rule.isAllReceived == 1) {
  699. strategy.select = 1
  700. } else {
  701. strategy.select = 0
  702. }
  703. }
  704. this.$refs.strategyListPoup.open()
  705. console.log('========拓客弹窗已打开=======')
  706. } else {
  707. console.log('========strategyList为空,不弹窗=======')
  708. }
  709. }).catch(err => {
  710. console.log('========getRuleById 请求失败=======', err)
  711. })
  712. },
  713. selectQuan(item, index) {
  714. if (this.rule.isAllReceived == 1) {
  715. return
  716. }
  717. console.log(item)
  718. item.select = item.select ? 0 : 1
  719. this.$set(this.rule.strategyList, index, item)
  720. },
  721. operLog() {
  722. let param = uni.getStorageSync('promotionParam')
  723. let userInfo = uni.getStorageSync('userInfo')
  724. // #ifdef MP-WEIXIN
  725. const accountInfo = wx.getAccountInfoSync();
  726. console.log(accountInfo.miniProgram.version, '小程序版本号')
  727. // #endif
  728. const data = {
  729. title: "小程序扫码记录",
  730. operParam: param.techNo,
  731. operName: userInfo.no,
  732. deptName: param.storeId,
  733. errorMsg: accountInfo.miniProgram.version
  734. }
  735. console.log(data)
  736. this.$api.scanLogs(data).then(res => {
  737. console.log('------日志发送成功---------')
  738. }).catch(errors => {
  739. console.log(errors, '------日志发送失败---------')
  740. })
  741. },
  742. goQrCode() {
  743. uni.navigateTo({
  744. // url: '/pages/qrCode/index'
  745. url: '/myPages/myActivity/myActivity'
  746. })
  747. },
  748. goActivity() {
  749. uni.navigateTo({
  750. url: '/orderPages/activityList/activityList'
  751. })
  752. },
  753. goRights() {
  754. uni.navigateTo({
  755. url: '/storePages/rights/index'
  756. })
  757. },
  758. // 去服务点单页面
  759. gotoServiceOrder() {
  760. uni.navigateTo({
  761. url: '/orderPages/storeService/index'
  762. })
  763. },
  764. goBookService() {
  765. uni.navigateTo({
  766. url: '/orderPages/bookService/index'
  767. })
  768. },
  769. //点击通知
  770. handleNoticeClick(e) {
  771. console.log(e)
  772. uni.navigateTo({
  773. url: '/storePages/notice/index?noticeId=' + e.noticeId,
  774. })
  775. },
  776. // 去优惠劵大厅
  777. gotoReceiveCoupons() {
  778. uni.navigateTo({
  779. url: '/orderPages/receiveCoupons/index'
  780. })
  781. },
  782. // 去我的优惠劵页面
  783. gotoCoupon() {
  784. uni.navigateTo({
  785. url: '/orderPages/myCoupon/index'
  786. })
  787. },
  788. // 储值服务
  789. gotoRechargeService() {
  790. uni.navigateTo({
  791. url: '/myPages/recharge/index?name=lisa',
  792. })
  793. },
  794. // 获取banner图片
  795. getSlideshowList() {
  796. let that = this;
  797. this.$api.getSlideshowList({
  798. data: this.reqParm
  799. }).then((res) => {
  800. this.getImgUrlByBannerOssId(res.data.data);
  801. })
  802. },
  803. async getImgUrlByBannerOssId(items) {
  804. for (let i = 0; i < items.length; i++) {
  805. if (items[i].slideshowId) {
  806. this.$api.getImage(items[i].slideshowId).then(res => {
  807. this.bannerList.push(res.data.data[0].url.replace(/^http:/, "https:"))
  808. })
  809. }
  810. }
  811. },
  812. // 获取门店列表数据
  813. getStoreListData(data) {
  814. let that = this;
  815. // 用户绑定门店
  816. this.$api.storeList(data).then((res) => {
  817. console.log(res.data.data[0])
  818. that.storeInfo = res.data.data[0]
  819. // 更新用户选择的门店信息
  820. uni.setStorageSync('storeInfo', res.data.data[0])
  821. })
  822. },
  823. getNoticeListData() {
  824. let req = {
  825. auth: false,
  826. noticeType: 2,
  827. status: 0
  828. }
  829. this.$api.noticeList(req).then((res) => {
  830. if (res.data.rows.length === 1) {
  831. this.noticeList.push(res.data.rows[0])
  832. this.noticeList.push(res.data.rows[0])
  833. } else {
  834. this.noticeList = res.data.rows;
  835. }
  836. })
  837. },
  838. getImgUrlByOssId(ossId) {
  839. if (ossId) {
  840. this.$api.getImage(ossId).then(res => {
  841. this.userInfo.selfPhotoUrl = res.data.data[0].url.replace(/^http:/, "https:")
  842. this.$set(this.userInfo)
  843. })
  844. }
  845. },
  846. // 获取经纬度信息f
  847. getLocation() {
  848. let that = this
  849. console.log('+++++++++++++开始获取位置信息++++++++++++++++')
  850. uni.getLocation({
  851. type: 'gcj02',
  852. success: function (res) {
  853. console.log(res)
  854. let latitude = res.latitude; // 纬度
  855. let longitude = res.longitude; // 经度
  856. let speed = res.speed; // 速度
  857. let accuracy = res.accuracy; // 精确度
  858. // 在这里可以对位置信息进行处理
  859. console.log("纬度:" + latitude + ";经度" + longitude)
  860. that.reqParm.latitude = latitude
  861. that.reqParm.longitude = longitude
  862. uni.setStorageSync('location', that.reqParm)
  863. },
  864. fail: function (fail) {
  865. console.log('获取用户地址失败==》', fail)
  866. },
  867. complete: function (complete) {
  868. console.log('获取用户地址失败or成功==》', complete)
  869. if (that.isGetAddress) {
  870. console.log("根据位置获取门店执行了 isGetAddress =>", that.isGetAddress)
  871. that.isGetAddress = !that.isGetAddress
  872. that.getStoreListData(that.reqParm)
  873. }
  874. }
  875. });
  876. },
  877. // 去选择门店
  878. gotoStoreChoose() {
  879. uni.navigateTo({
  880. url: '/storePages/store/store-choose?type=1',
  881. })
  882. },
  883. // 去再来一单
  884. gotoComeOrder() {
  885. uni.$u.route({
  886. url: '/pages/index/tabbar',
  887. params: {
  888. PageCur: 'orderList',
  889. status: '4'
  890. }
  891. })
  892. },
  893. // 去订单页面
  894. gotoOrder() {
  895. uni.setStorageSync('orderListIndex', 1)
  896. uni.switchTab({
  897. url: '/pages/order/index',
  898. })
  899. },
  900. // 去商品下单页面
  901. gotoGoods() {
  902. uni.navigateTo({
  903. url: '/orderPages/bookService/index',
  904. })
  905. },
  906. // 用户绑定门店
  907. userBindStore() {
  908. let that = this;
  909. // 用户绑定门店
  910. this.$api.userBindStore(this.reqParm).then((res) => {
  911. console.log(this.reqParm)
  912. })
  913. },
  914. updateApp() {
  915. const updateManager = uni.getUpdateManager();
  916. updateManager.onCheckForUpdate(function (res) {
  917. // 请求完新版本信息的回调
  918. console.log('++++++++++onCheckForUpdate++++++++++', res.hasUpdate);
  919. if (res.hasUpdate) {
  920. updateManager.onUpdateReady(function (res) {
  921. console.log('+++++++++onUpdateReady+++++++++++++', res)
  922. uni.showModal({
  923. title: '更新提示',
  924. content: '新版本已经准备好,是否重启应用?',
  925. showCancel: false,
  926. success(res) {
  927. if (res.confirm) {
  928. // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
  929. updateManager.applyUpdate();
  930. }
  931. }
  932. });
  933. });
  934. updateManager.onUpdateFailed(function (res) {
  935. // 新的版本下载失败
  936. console.log('+++++++++onUpdateFailed+++++++++++++', res)
  937. uni.showModal({
  938. title: '更新提示',
  939. content: '检测到小程序更新,但是下载失败,请检查网络',
  940. showCancel: false
  941. });
  942. });
  943. }
  944. });
  945. },
  946. }
  947. };
  948. </script>
  949. <style scoped lang="scss">
  950. @import "index.rpx.css";
  951. /* 头部内容 */
  952. .head-wrap {
  953. height: 100vh;
  954. background: #FFE05C;
  955. overflow: auto;
  956. .content-info {
  957. position: relative;
  958. .h-bg {
  959. height: 680rpx;
  960. }
  961. .content {
  962. position: absolute;
  963. top: 460rpx;
  964. left: 24rpx;
  965. right: 24rpx;
  966. border-radius: 12rpx;
  967. padding-bottom: 40rpx;
  968. .h-notice-bar {
  969. padding-left: 20rpx;
  970. background: #FFFFFF;
  971. box-shadow: 0rpx 8rpx 16rpx 0rpx rgba(237, 86, 159, 0.05);
  972. border-radius: 20rpx;
  973. }
  974. .noticeCard {
  975. margin-top: 10rpx;
  976. padding: 10rpx;
  977. background: #FFFFFF;
  978. box-shadow: 0rpx 8rpx 16rpx 0rpx rgba(237, 86, 159, 0.05);
  979. border-radius: 10px;
  980. }
  981. .h-content-wrap {
  982. background: #fff;
  983. border-radius: 10px;
  984. /* 欢迎语 */
  985. .welcome-wrap {
  986. padding-top: 12px;
  987. display: flex;
  988. margin-left: 12px;
  989. margin-right: 12px;
  990. margin-top: 16px;
  991. align-items: center;
  992. .logo {
  993. width: 13%;
  994. image {
  995. border-radius: 18px;
  996. width: 36px;
  997. height: 36px;
  998. }
  999. }
  1000. .text {
  1001. width: 60%;
  1002. font-size: 14px;
  1003. .welcome-wrap {
  1004. font-size: 12px;
  1005. color: #999999;
  1006. }
  1007. .welcome {
  1008. font-size: 12px;
  1009. color: #999999;
  1010. }
  1011. }
  1012. .arrow-right {
  1013. width: 30%;
  1014. text-align: center;
  1015. cursor: pointer;
  1016. display: flex;
  1017. justify-content: center;
  1018. background: #fff8db;
  1019. // background: red;
  1020. height: 32px;
  1021. align-items: center;
  1022. border-radius: 16px;
  1023. .qrcode {
  1024. height: 20px;
  1025. width: 20px;
  1026. }
  1027. .h-text {
  1028. font-size: 12px;
  1029. color: #999999;
  1030. }
  1031. .coupon-wrap {
  1032. display: flex;
  1033. font-size: 14px;
  1034. align-items: center;
  1035. }
  1036. }
  1037. }
  1038. /* 钱包信息 */
  1039. .balance-info {
  1040. font-size: 12px;
  1041. padding-left: 12px;
  1042. margin-bottom: 16px;
  1043. margin-top: 12px;
  1044. color: #666;
  1045. display: flex;
  1046. justify-content: space-around;
  1047. text-align: center;
  1048. .balance-amount {
  1049. padding-right: 4px;
  1050. }
  1051. .score-info {
  1052. padding-right: 4px;
  1053. }
  1054. .coupon-info {
  1055. padding-right: 4px;
  1056. }
  1057. .e-currency-info {
  1058. padding-right: 4px;
  1059. }
  1060. .number {
  1061. color: #333333;
  1062. font-size: 14px;
  1063. }
  1064. }
  1065. /* 商店信息 */
  1066. .store-wrap {
  1067. margin: 10px;
  1068. .store-info {
  1069. display: flex;
  1070. .logo {
  1071. width: 10%;
  1072. text-align: center;
  1073. display: flex;
  1074. justify-content: center;
  1075. align-items: center;
  1076. image {
  1077. width: 30px;
  1078. height: 30px;
  1079. }
  1080. }
  1081. .store-content {
  1082. width: 90%;
  1083. padding-bottom: 13px;
  1084. .h-row {
  1085. display: flex;
  1086. align-items: center;
  1087. justify-content: space-between;
  1088. .store-desc {
  1089. width: 90%;
  1090. display: flex;
  1091. line-height: 30px;
  1092. font-size: 14px;
  1093. .store-name {
  1094. }
  1095. }
  1096. .arrow-right {
  1097. text-align: right;
  1098. margin: 0 auto;
  1099. cursor: pointer;
  1100. padding-top: 3px;
  1101. width: 100px;
  1102. display: flex;
  1103. font-size: 14px;
  1104. .change-store {
  1105. text-align: right;
  1106. color: #666;
  1107. }
  1108. image {
  1109. width: 18px;
  1110. height: 18px;
  1111. }
  1112. }
  1113. .address {
  1114. width: 400rpx;
  1115. color: #999999;
  1116. font-size: 12px;
  1117. padding-right: 12px;
  1118. }
  1119. .address1 {
  1120. color: #999999;
  1121. font-size: 12px;
  1122. padding-right: 12px;
  1123. }
  1124. }
  1125. }
  1126. }
  1127. .adress {
  1128. font-size: 22rpx;
  1129. white-space: nowrap;
  1130. overflow: hidden;
  1131. text-overflow: ellipsis;
  1132. padding-left: 80rpx;
  1133. color: #666;
  1134. }
  1135. }
  1136. }
  1137. }
  1138. }
  1139. }
  1140. /* 上次订单 */
  1141. .nav-wrap {
  1142. background: #fff;
  1143. border-radius: 8px;
  1144. margin-top: 16px;
  1145. .upper-order-wrap {
  1146. display: flex;
  1147. border-radius: 6px;
  1148. justify-content: center;
  1149. .left-content {
  1150. margin-top: 20px;
  1151. width: 50%;
  1152. font-size: 12px;
  1153. text-align: center;
  1154. border-radius: 10px;
  1155. .title {
  1156. font-size: 18px;
  1157. text-align: center;
  1158. }
  1159. .desc {
  1160. padding-top: 6px;
  1161. color: #999999;
  1162. }
  1163. .bg-img {
  1164. text-align: center;
  1165. height: 100px;
  1166. display: flex;
  1167. justify-content: center;
  1168. align-items: center;
  1169. image {
  1170. width: 78px;
  1171. height: 78px;
  1172. }
  1173. }
  1174. }
  1175. .right-content {
  1176. margin-top: 20px;
  1177. width: 50%;
  1178. font-size: 12px;
  1179. text-align: center;
  1180. .title {
  1181. font-size: 18px;
  1182. text-align: center;
  1183. }
  1184. .desc {
  1185. padding-top: 6px;
  1186. color: #999999;
  1187. }
  1188. .bg-img {
  1189. height: 100px;
  1190. text-align: center;
  1191. display: flex;
  1192. justify-content: center;
  1193. align-items: center;
  1194. image {
  1195. width: 78px;
  1196. height: 78px;
  1197. }
  1198. }
  1199. }
  1200. }
  1201. .menu-tab {
  1202. display: flex;
  1203. justify-content: space-around; // 平均分布
  1204. justify-content: center;
  1205. padding-bottom: 8px;
  1206. .button-wrap {
  1207. flex: 1;
  1208. display: flex;
  1209. align-items: center;
  1210. justify-content: center;
  1211. margin-top: 16px;
  1212. margin-bottom: 18px;
  1213. .name {
  1214. padding-top: 3px;
  1215. font-size: 12px;
  1216. color: #666666;
  1217. }
  1218. .btn {
  1219. padding-left: 12px;
  1220. padding-right: 12px;
  1221. height: 36px;
  1222. border-radius: 18px;
  1223. .icon {
  1224. display: flex;
  1225. padding-right: 6px;
  1226. align-items: center;
  1227. justify-content: center;
  1228. image {
  1229. height: 14px;
  1230. width: 14px;
  1231. }
  1232. }
  1233. }
  1234. }
  1235. }
  1236. }
  1237. /* 为你推荐 */
  1238. .recommend-wrap {
  1239. margin-top: 16px;
  1240. background: #fff;
  1241. border-radius: 8px;
  1242. .recommend-nav {
  1243. display: flex;
  1244. margin-left: 12px;
  1245. padding-top: 8px;
  1246. padding-bottom: 4px;
  1247. align-items: center;
  1248. .icon {
  1249. padding-right: 4px;
  1250. image {
  1251. height: 26px;
  1252. width: 26px;
  1253. }
  1254. }
  1255. .title {
  1256. font-size: 16px;
  1257. }
  1258. }
  1259. /* 门店列表 */
  1260. .store-wrap {
  1261. margin: 12px;
  1262. height: 100px;
  1263. .store-list {
  1264. margin-top: 16px;
  1265. .store-content {
  1266. display: flex;
  1267. .store-img {
  1268. width: 30%;
  1269. image {
  1270. width: 100%;
  1271. height: 78px;
  1272. border-radius: 6px;
  1273. }
  1274. }
  1275. .h-store-content {
  1276. width: 70%;
  1277. padding-left: 8px;
  1278. padding-top: 4px;
  1279. .title {
  1280. font-size: 18px;
  1281. font-family: "黑体", sans-serif;
  1282. }
  1283. .adress {
  1284. font-size: 28rpx;
  1285. line-height: 36rpx;
  1286. -webkit-box-orient: vertical;
  1287. -webkit-line-clamp: 1;
  1288. white-space: nowrap;
  1289. overflow: hidden;
  1290. text-overflow: ellipsis;
  1291. color: #666;
  1292. }
  1293. .price {
  1294. color: #666;
  1295. width: 60%;
  1296. font-size: 14px;
  1297. line-height: 22px;
  1298. .red {
  1299. color: red;
  1300. font-size: 16px;
  1301. }
  1302. }
  1303. .desc {
  1304. display: flex;
  1305. padding-top: 3px;
  1306. .price {
  1307. width: 60%;
  1308. font-size: 14px;
  1309. line-height: 22px;
  1310. }
  1311. .order-btn {
  1312. width: 100%;
  1313. .btn {
  1314. background: #FFE05C;
  1315. text-align: center;
  1316. border-radius: 14px;
  1317. height: 26px;
  1318. line-height: 26px;
  1319. color: #333;
  1320. font-size: 12px;
  1321. }
  1322. }
  1323. }
  1324. }
  1325. }
  1326. }
  1327. }
  1328. }
  1329. /* 底部 */
  1330. .footer {
  1331. margin-top: 30px;
  1332. height: 60px;
  1333. font-size: 12px;
  1334. text-align: center;
  1335. color: #666;
  1336. margin-bottom: 40px;
  1337. background-color: #FFE05C;
  1338. }
  1339. .tabBarView {
  1340. position: fixed;
  1341. bottom: 0;
  1342. }
  1343. </style>