index.vue 41 KB

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