index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658
  1. <template>
  2. <view class="container">
  3. <uni-nav-bar title="门店" backgroundColor='#03803B' color="#fff" fixed statusBar @clickRight="inSetting">
  4. </uni-nav-bar>
  5. <image class="background-image" src="/static/images/home/527@2x.png" style="width: 100%;height: 320rpx;"
  6. mode="scaleToFill"></image>
  7. <view style="display: flex;align-items: center;" @click="allClick('商品检索')">
  8. <view style="width: 100%;">
  9. <uni-search-bar bgColor="#F6F6F6 " placeholder="请输入商品名称" radius="20">
  10. </uni-search-bar>
  11. </view>
  12. </view>
  13. <view style="padding: 10rpx 20rpx 0 20rpx;">
  14. <view style="border-radius: 10rpx;overflow: hidden;">
  15. <uni-swiper-dot :info="swiperList" :current="dotCurrent" mode="round" :dots-styles="dotsStyles">
  16. <swiper circular :autoplay="true" :interval="2000" :duration="500" @change="swiperChange">
  17. <!-- <swiper-item v-for="(item,index) in swiperList" :key="index">
  18. <image mode="scaleToFill" :src="item" style="width: 100%;height: 100%;">
  19. </image>
  20. </swiper-item> -->
  21. <swiper-item>
  22. <image mode="scaleToFill" src="@/static/images/home/sw1.jpg"
  23. style="width: 100%;height: 100%;">
  24. </image>
  25. </swiper-item>
  26. <swiper-item>
  27. <image mode="scaleToFill" src="@/static/images/home/sw2.jpg"
  28. style="width: 100%;height: 100%;">
  29. </image>
  30. </swiper-item>
  31. <swiper-item>
  32. <image mode="scaleToFill" src="@/static/images/home/sw3.png"
  33. style="width: 100%;height: 100%;">
  34. </image>
  35. </swiper-item>
  36. <swiper-item>
  37. <image mode="scaleToFill" src="@/static/images/home/sw4.jpg"
  38. style="width: 100%;height: 100%;">
  39. </image>
  40. </swiper-item>
  41. </swiper>
  42. </uni-swiper-dot>
  43. </view>
  44. </view>
  45. <view class="home-card">
  46. <uni-grid :column="4" :showBorder="false">
  47. <uni-grid-item>
  48. <view class="grid-item-box" @click="allClick('轮胎保注册')">
  49. <view class="grid-item-box-img">
  50. <image style="width: 100rpx;height: 80rpx;" src="@/static/images/home/home (17).png" />
  51. </view>
  52. <view class="grid-item-box-text">
  53. 轮胎保
  54. </view>
  55. </view>
  56. </uni-grid-item>
  57. <uni-grid-item>
  58. <view class="grid-item-box" @click="allClick('保单')">
  59. <view class="grid-item-box-img">
  60. <image style="width: 100rpx;height: 80rpx;" src="@/static/images/home/home (18).png" />
  61. </view>
  62. <view class="grid-item-box-text">
  63. 保单
  64. </view>
  65. </view>
  66. </uni-grid-item>
  67. </uni-grid>
  68. </view>
  69. <view @click="">
  70. <image src="/static/images/home/JF.png" style="width: 100%;height: 251rpx;" mode="scaleToFill">
  71. </image>
  72. </view>
  73. <view class="home-card">
  74. <u-tabs :list="dianjiqielist" v-model="groupModel" @click="groupChange" :lineHeight='0'
  75. :activeStyle="activeStyle" :inactiveStyle="inactiveStyle"></u-tabs>
  76. <view style="padding: 16rpx;border-top: 2px #F1F1F1 solid;;">
  77. <uni-grid :column="2" :show-border="false" :square="false" :highlight="false"
  78. v-if="dataList.length > 0">
  79. <uni-grid-item v-for="(item ,index) in dataList" :key="index">
  80. <view class="goodsImg" @click="choice(item,index)">
  81. <image v-if="item.inventoryLocal > 0" src="/static/images/home/xsd2x.png" mode="aspectFit"
  82. class='imgIcon' />
  83. <image v-if="item.inventoryLocal == 0&&item.inventoryShare > 0"
  84. src="/static/images/home/crd2x.png" mode="aspectFit" class='imgIcon' />
  85. <image :src="item.url" mode="aspectFit"
  86. style="width:300rpx;height:300rpx;border-radius:20rpx;border: 2rpx #E7E7E7 solid;" />
  87. <text class="text">{{item.cname}}</text>
  88. <text
  89. style="color:#03803B;width: 300rpx;font-weight: bold;font-size: 32rpx;">¥{{checkStatus == '审核通过'?item.price:'***'}}</text>
  90. </view>
  91. </uni-grid-item>
  92. </uni-grid>
  93. <u-empty v-if="dataList.length == 0" mode="list" icon="/static/images/home/emptylist.jpg" text='暂无数据' />
  94. </view>
  95. </view>
  96. <u-loadmore v-if="page.total !== 0 && dataList.length != 0" :status="status" />
  97. <u-back-top :scroll-top="scrollTop"></u-back-top>
  98. <view class="suspensionBox" @click="opensalesman">
  99. <u-icon name="server-fill" color="#2979ff" size="30"></u-icon>
  100. </view>
  101. <u-modal :show="salesmanShow" title="业务员联系方式" showCancelButton confirmText="拨号" cancelText="关闭"
  102. @confirm="clickCall" @cancel="salesmanShow=false">
  103. <view class="slot-content">
  104. <view style="margin-bottom: 10rpx;">业务员:{{salesmanName?salesmanName:''}}</view>
  105. <view>电话:{{phoneNumber?phoneNumber:''}}</view>
  106. </view>
  107. </u-modal>
  108. <!-- 更新组件 force 是否强制更新 tabbar:页面是否有原生tabbar组件-->
  109. <app-update ref="app_update" :force="false" :tabbar="true"></app-update>
  110. </view>
  111. </template>
  112. <script>
  113. import appUpdate from "@/components/yzhua006-update/app-update.vue"
  114. import {
  115. appList,
  116. userDept,
  117. validationCorpEmpty,
  118. isProcurement,
  119. brandDescList,
  120. brandDescDetail
  121. } from '@/api/home/index.js'
  122. import {
  123. shoppingCartList
  124. } from '@/api/goods/index.js'
  125. import {
  126. details,
  127. nameDetail
  128. } from '@/api/personalInformation/index.js'
  129. import {
  130. activityList
  131. } from '@/api/activity/index.js'
  132. import {
  133. getAddress
  134. } from '@/api/home/index.js'
  135. export default {
  136. components: {
  137. appUpdate
  138. },
  139. data() {
  140. return {
  141. dotsStyles: {
  142. backgroundColor: 'rgba(0, 0, 0, .1)',
  143. border: '1px #03803B solid',
  144. color: '#03803B',
  145. selectedBackgroundColor: '#03803B',
  146. selectedBorder: '1px #03803B solid'
  147. },
  148. dotCurrent: 0,
  149. groupModel: '全部',
  150. swiperList: [
  151. '@/static/images/home/sw1.jpg',
  152. '@/static/images/home/sw2.jpg',
  153. '@/static/images/home/sw3.jpg',
  154. '@/static/images/home/sw4.jpg'
  155. ],
  156. activeStyle: {
  157. color: '#03803B',
  158. fontWeight: 'bold',
  159. fontSize: '28rpx'
  160. },
  161. inactiveStyle: {
  162. color: '#797979',
  163. fontSize: '28rpx'
  164. },
  165. dianjiqielist: [{
  166. name: '全部',
  167. },
  168. {
  169. name: '静音棉',
  170. },
  171. {
  172. name: '自修补',
  173. },
  174. {
  175. name: '防爆',
  176. }
  177. ],
  178. dataList: [],
  179. scrollTop: 0,
  180. status: 'loadmore',
  181. page: {
  182. total: 0,
  183. size: 10,
  184. current: 1
  185. },
  186. checkStatus: '',
  187. salesmanName: '', // 业务员姓名
  188. phoneNumber: '', // 业务员联系电话
  189. salesmanShow: false, // 联系业务员弹窗
  190. cloudWarehouse: 0,
  191. showIcon: true
  192. }
  193. },
  194. onPageScroll(e) {
  195. this.scrollTop = e.scrollTop;
  196. },
  197. onPullDownRefresh() {
  198. // 调用数据刷新方法
  199. this.refreshData();
  200. setTimeout(() => {
  201. uni.stopPullDownRefresh(); // 停止下拉刷新动画
  202. }, 1000);
  203. },
  204. onReachBottom() {
  205. this.status = 'loading'
  206. if (this.dataList.length < this.page.total) {
  207. this.page.current++
  208. this.onSearch()
  209. } else {
  210. this.status = 'nomore'
  211. }
  212. },
  213. onLoad() {
  214. if (uni.getStorageSync('accessToken')) {
  215. this.getAddressdata()
  216. }
  217. // this.getbrandDescList()
  218. this.page = {
  219. total: 0,
  220. size: 10,
  221. current: 1
  222. }
  223. this.dataList = []
  224. this.onSearch()
  225. },
  226. onShow() {
  227. this.getDetails()
  228. // this.getBadge()
  229. this.$u.api.isDisable()
  230. },
  231. mounted() {
  232. this.$refs.app_update.update();
  233. },
  234. methods: {
  235. getDetails() {
  236. // 获取审核状态
  237. details().then(res => {
  238. this.checkStatus = res.data.checkStatus
  239. this.enableOrNot = res.data.enableOrNot
  240. uni.setStorageSync('checkStatus', res.data.checkStatus);
  241. uni.setStorageSync('enableOrNot', res.data.enableOrNot);
  242. // 查询业务员详情拿取手机号
  243. this.salesmanName = res.data.salesmanName
  244. if (!this.phoneNumber) {
  245. nameDetail({
  246. id: res.data.salesmanId
  247. }).then(res => {
  248. this.phoneNumber = res.data.phone
  249. })
  250. }
  251. })
  252. },
  253. getBadge() {
  254. // activityList({
  255. // current: 1,
  256. // size: 10,
  257. // status: 1
  258. // }).then(res => {
  259. // uni.setTabBarBadge({
  260. // index: 1, // tabIndex,tabBar的哪一项,从0开始
  261. // text: res.data.total.toString() // 显示的文本,超过 99 显示成 “…”
  262. // })
  263. // })
  264. shoppingCartList().then(res => {
  265. let num = res.data.length
  266. uni.setTabBarBadge({
  267. index: 3, // tabIndex,tabBar的哪一项,从0开始
  268. text: num.toString() // 显示的文本,超过 99 显示成 “…”
  269. })
  270. })
  271. },
  272. getbrandDescList() {
  273. brandDescList({
  274. type: 'LBT',
  275. whetherIntegral: "0"
  276. }).then(res => {
  277. brandDescDetail({
  278. id: res.data.records[0].id
  279. }).then(res => {
  280. this.list3 = res.data.brandFilesList.map(item => {
  281. return item.url
  282. })
  283. })
  284. })
  285. },
  286. refreshData() {
  287. this.page = {
  288. total: 0,
  289. size: 10,
  290. current: 1
  291. }
  292. this.search = {}
  293. this.dataList = []
  294. this.onSearch()
  295. },
  296. insearchPage() {
  297. if (this.checkStatus != '审核通过') {
  298. uni.showToast({
  299. title: "当前用户未授权,请联系客服",
  300. icon: "none",
  301. mask: true
  302. });
  303. return
  304. }
  305. uni.switchTab({
  306. url: '/pages/tabBar/classification'
  307. });
  308. },
  309. // 车型
  310. clickVehicle() {
  311. if (this.checkStatus != '审核通过') {
  312. uni.showToast({
  313. title: "当前用户未授权,请联系客服",
  314. icon: "none",
  315. mask: true
  316. });
  317. return
  318. }
  319. this.$u.route('/pages/tabBar/vehicleModel');
  320. },
  321. swiperChange(e) {
  322. this.dotCurrent = e.detail.current;
  323. },
  324. // 点击联系业务员
  325. clickCall() {
  326. uni.makePhoneCall({
  327. phoneNumber: this.phoneNumber,
  328. success: function() {
  329. console.log('拨打电话成功');
  330. this.salesmanShow = false
  331. },
  332. fail() {
  333. console.log('打电话失败了');
  334. this.salesmanShow = false
  335. }
  336. })
  337. },
  338. // 数组排序 property:根据什么属性排序
  339. compare(property) {
  340. return function(a, b) {
  341. var value1 = a[property]
  342. var value2 = b[property]
  343. return value1 - value2
  344. }
  345. },
  346. groupChange(e) {
  347. if (e.name == '静音棉') {
  348. this.originalFactory = 1
  349. this.selfRecovery = 0
  350. this.explosionProof = 0
  351. } else if (e.name == '自修补') {
  352. this.originalFactory = 0
  353. this.selfRecovery = 1
  354. this.explosionProof = 0
  355. } else if (e.name == '防爆') {
  356. this.originalFactory = 0
  357. this.selfRecovery = 0
  358. this.explosionProof = 1
  359. } else {
  360. this.originalFactory = 0
  361. this.selfRecovery = 0
  362. this.explosionProof = 0
  363. }
  364. this.page.current = 1
  365. this.dataList = []
  366. this.onSearch()
  367. },
  368. // 获取列表数据
  369. onSearch() {
  370. let obj = {}
  371. if (this.originalFactory) {
  372. obj.originalFactory = 1
  373. }
  374. if (this.selfRecovery) {
  375. obj.selfRecovery = 1
  376. }
  377. if (this.explosionProof) {
  378. obj.explosionProof = 1
  379. }
  380. uni.showLoading({
  381. title: '加载中',
  382. mask: true
  383. });
  384. appList({
  385. size: this.page.size,
  386. current: this.page.current,
  387. ...obj,
  388. ...this.search,
  389. }).then(res => {
  390. this.dataList = this.dataList.concat(res.data.records)
  391. this.page.total = res.data.total
  392. if (this.dataList.length == res.data.total) {
  393. this.status = 'nomore'
  394. }
  395. uni.hideLoading();
  396. }).catch(err => {
  397. uni.hideLoading();
  398. })
  399. },
  400. choice(row) {
  401. console.log(row)
  402. if (this.checkStatus != '审核通过') {
  403. uni.showToast({
  404. title: "当前用户未授权,请联系客服",
  405. icon: "none",
  406. mask: true
  407. });
  408. return
  409. }
  410. // uni.$u.route('/pages/goods/details', {
  411. // id: item.id
  412. // });
  413. uni.navigateTo({
  414. url: '/pages/goods/details?id=' + row.id,
  415. });
  416. },
  417. opensalesman() {
  418. if (this.checkStatus != '审核通过') {
  419. uni.showToast({
  420. title: "当前用户未授权,请联系客服",
  421. icon: "none",
  422. mask: true
  423. });
  424. return
  425. }
  426. this.salesmanShow = true
  427. },
  428. swiperChange(e) {
  429. this.dotCurrent = e.detail.current;
  430. },
  431. inSetting() {
  432. uni.navigateTo({
  433. url: '/pages/home/setting'
  434. });
  435. },
  436. getAddressdata() {
  437. if (!uni.getStorageSync("addressData")) {
  438. getAddress().then(res => {
  439. uni.setStorageSync('addressData', JSON.stringify(res.data));
  440. })
  441. }
  442. },
  443. allClick(name) {
  444. this.$u.api.isDisable()
  445. if (name == '轮胎保注册') {
  446. uni.navigateTo({
  447. url: '/pages/home/insurance/index'
  448. });
  449. }
  450. if (name == '保单') {
  451. uni.navigateTo({
  452. url: '/pages/home/claim/index'
  453. });
  454. }
  455. if (name == '商品检索') {
  456. uni.reLaunch({
  457. url: '/pages/goods/index'
  458. })
  459. }
  460. }
  461. }
  462. }
  463. </script>
  464. <style lang="scss" scoped>
  465. ::v-deep .uni-navbar--border {
  466. border-bottom-color: #03803B !important;
  467. }
  468. .container {
  469. position: relative;
  470. .background-image {
  471. position: absolute;
  472. /* 将图片置于组件后面 */
  473. }
  474. ::v-deep .uni-searchbar {
  475. background-color: #03803B !important;
  476. pointer-events: none !important;
  477. user-select: none !important;
  478. }
  479. .swiper-item {
  480. display: block;
  481. height: 300rpx;
  482. line-height: 300rpx;
  483. text-align: center;
  484. background-color: #FFFFFF;
  485. }
  486. .home-card {
  487. background-color: #fff;
  488. border-radius: 10rpx;
  489. overflow: hidden;
  490. margin: 20rpx;
  491. padding: 20rpx;
  492. .goodsImg {
  493. display: flex;
  494. flex-direction: column;
  495. align-items: center;
  496. justify-content: center;
  497. margin: 16rpx 0;
  498. .text {
  499. white-space: nowrap;
  500. overflow: hidden;
  501. text-overflow: ellipsis;
  502. width: 300rpx;
  503. text-align: center;
  504. font-size: 24rpx;
  505. color: #797979;
  506. }
  507. }
  508. .home-card-title {
  509. font-weight: 500;
  510. font-size: 34rpx;
  511. color: #0F0D0D;
  512. margin-left: 20rpx;
  513. margin-bottom: 10rpx;
  514. }
  515. ::v-deep .uni-grid-item {
  516. align-items: center;
  517. }
  518. .grid-item-box {
  519. display: flex;
  520. flex-direction: column;
  521. align-items: center;
  522. .uni-grid-item__box {
  523. justify-content: center;
  524. }
  525. .grid-item-box-img {
  526. display: flex;
  527. justify-content: center;
  528. align-items: center;
  529. // width: 100rpx;
  530. // height: 100rpx;
  531. }
  532. .grid-item-box-text {
  533. width: 100rpx;
  534. text-align: center;
  535. font-weight: 500;
  536. font-size: 26rpx;
  537. color: #6A6A6A;
  538. }
  539. }
  540. }
  541. }
  542. .nav-right {
  543. width: 32rpx;
  544. height: 30rpx;
  545. }
  546. .suspensionBox {
  547. width: 80rpx;
  548. height: 80rpx;
  549. background: #fff;
  550. border-radius: 50%;
  551. position: fixed;
  552. bottom: 200rpx;
  553. right: 40rpx;
  554. box-shadow: 4px 4px 8px 1px rgba(0, 0, 0, .5);
  555. display: flex;
  556. align-items: center;
  557. justify-content: center;
  558. }
  559. .card {
  560. background-color: #fff;
  561. border-radius: 10rpx;
  562. overflow: hidden;
  563. margin: 12rpx 0;
  564. }
  565. .carBtn {
  566. display: flex;
  567. align-items: center;
  568. justify-content: center;
  569. color: #03803B;
  570. font-weight: bold;
  571. width: 25%;
  572. text-align: center;
  573. background-color: #fff;
  574. height: 64rpx;
  575. border-radius: 36rpx;
  576. margin-right: 20rpx;
  577. }
  578. .brandImg {
  579. display: flex;
  580. flex-direction: column;
  581. align-items: center;
  582. justify-content: center;
  583. margin: 16rpx 0;
  584. .text {
  585. white-space: nowrap;
  586. overflow: hidden;
  587. text-overflow: ellipsis;
  588. width: 140rpx;
  589. text-align: center;
  590. font-size: 24rpx;
  591. color: #797979;
  592. }
  593. }
  594. .goodsImg {
  595. display: flex;
  596. flex-direction: column;
  597. align-items: center;
  598. justify-content: center;
  599. margin: 16rpx 0;
  600. .text {
  601. white-space: nowrap;
  602. overflow: hidden;
  603. text-overflow: ellipsis;
  604. width: 300rpx;
  605. text-align: center;
  606. font-size: 24rpx;
  607. color: #797979;
  608. }
  609. }
  610. .container {
  611. position: relative;
  612. }
  613. .background-image {
  614. position: absolute;
  615. z-index: -1;
  616. /* 将图片置于组件后面 */
  617. }
  618. .imgIcon {
  619. position: absolute;
  620. width: 100rpx;
  621. height: 35rpx;
  622. top: 16rpx;
  623. right: 36rpx;
  624. }
  625. </style>