index.vue 39 KB

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