index.vue 44 KB

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