index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666
  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: 80rpx;height: 80rpx;" src="@/static/images/home/baoxian.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: 80rpx;height: 80rpx;" src="@/static/images/home/chexian.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/shoppingCart/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. this.page = {
  215. total: 0,
  216. size: 10,
  217. current: 1
  218. }
  219. this.dataList = []
  220. this.onSearch()
  221. },
  222. onShow() {
  223. this.getDetails()
  224. this.getBadge()
  225. this.$u.api.isDisable()
  226. },
  227. mounted() {
  228. this.$refs.app_update.update();
  229. },
  230. methods: {
  231. getDetails() {
  232. // 获取审核状态
  233. details().then(res => {
  234. this.checkStatus = res.data.checkStatus
  235. this.enableOrNot = res.data.enableOrNot
  236. uni.setStorageSync('checkStatus', res.data.checkStatus);
  237. uni.setStorageSync('enableOrNot', res.data.enableOrNot);
  238. // 查询业务员详情拿取手机号
  239. this.salesmanName = res.data.salesmanName
  240. if (!this.phoneNumber) {
  241. nameDetail({
  242. id: res.data.salesmanId
  243. }).then(res => {
  244. this.phoneNumber = res.data.phone
  245. })
  246. }
  247. })
  248. },
  249. getBadge() {
  250. // activityList({
  251. // current: 1,
  252. // size: 10,
  253. // status: 1
  254. // }).then(res => {
  255. // uni.setTabBarBadge({
  256. // index: 1, // tabIndex,tabBar的哪一项,从0开始
  257. // text: res.data.total.toString() // 显示的文本,超过 99 显示成 “…”
  258. // })
  259. // })
  260. shoppingCartList().then(res => {
  261. let num = res.data.length
  262. if (num) {
  263. uni.setTabBarBadge({
  264. index: 3, // tabIndex,tabBar的哪一项,从0开始
  265. text: num.toString() // 显示的文本,超过 99 显示成 “…”
  266. })
  267. } else {
  268. uni.removeTabBarBadge({
  269. index: 3, // tabIndex,tabBar的哪一项,从0开始
  270. })
  271. }
  272. })
  273. },
  274. getbrandDescList() {
  275. brandDescList({
  276. type: 'LBT',
  277. whetherIntegral: "0"
  278. }).then(res => {
  279. brandDescDetail({
  280. id: res.data.records[0].id
  281. }).then(res => {
  282. this.list3 = res.data.brandFilesList.map(item => {
  283. return item.url
  284. })
  285. })
  286. })
  287. },
  288. refreshData() {
  289. this.page = {
  290. total: 0,
  291. size: 10,
  292. current: 1
  293. }
  294. this.search = {}
  295. this.dataList = []
  296. this.onSearch()
  297. },
  298. insearchPage() {
  299. if (this.checkStatus != '审核通过') {
  300. uni.showToast({
  301. title: "当前用户未授权,请联系客服",
  302. icon: "none",
  303. mask: true
  304. });
  305. return
  306. }
  307. uni.switchTab({
  308. url: '/pages/tabBar/classification'
  309. });
  310. },
  311. // 车型
  312. clickVehicle() {
  313. if (this.checkStatus != '审核通过') {
  314. uni.showToast({
  315. title: "当前用户未授权,请联系客服",
  316. icon: "none",
  317. mask: true
  318. });
  319. return
  320. }
  321. this.$u.route('/pages/tabBar/vehicleModel');
  322. },
  323. swiperChange(e) {
  324. this.dotCurrent = e.detail.current;
  325. },
  326. // 点击联系业务员
  327. clickCall() {
  328. uni.makePhoneCall({
  329. phoneNumber: this.phoneNumber,
  330. success: function() {
  331. console.log('拨打电话成功');
  332. this.salesmanShow = false
  333. },
  334. fail() {
  335. console.log('打电话失败了');
  336. this.salesmanShow = false
  337. }
  338. })
  339. },
  340. // 数组排序 property:根据什么属性排序
  341. compare(property) {
  342. return function(a, b) {
  343. var value1 = a[property]
  344. var value2 = b[property]
  345. return value1 - value2
  346. }
  347. },
  348. groupChange(e) {
  349. if (e.name == '静音棉') {
  350. this.originalFactory = 1
  351. this.selfRecovery = 0
  352. this.explosionProof = 0
  353. } else if (e.name == '自修补') {
  354. this.originalFactory = 0
  355. this.selfRecovery = 1
  356. this.explosionProof = 0
  357. } else if (e.name == '防爆') {
  358. this.originalFactory = 0
  359. this.selfRecovery = 0
  360. this.explosionProof = 1
  361. } else {
  362. this.originalFactory = 0
  363. this.selfRecovery = 0
  364. this.explosionProof = 0
  365. }
  366. this.page.current = 1
  367. this.dataList = []
  368. this.onSearch()
  369. },
  370. // 获取列表数据
  371. onSearch() {
  372. let obj = {}
  373. if (this.originalFactory) {
  374. obj.originalFactory = 1
  375. }
  376. if (this.selfRecovery) {
  377. obj.selfRecovery = 1
  378. }
  379. if (this.explosionProof) {
  380. obj.explosionProof = 1
  381. }
  382. uni.showLoading({
  383. title: '加载中',
  384. mask: true
  385. });
  386. appList({
  387. size: this.page.size,
  388. current: this.page.current,
  389. ...obj,
  390. ...this.search,
  391. }).then(res => {
  392. this.dataList = this.dataList.concat(res.data.records)
  393. this.page.total = res.data.total
  394. if (this.dataList.length == res.data.total) {
  395. this.status = 'nomore'
  396. }
  397. uni.hideLoading();
  398. }).catch(err => {
  399. uni.hideLoading();
  400. })
  401. },
  402. choice(row) {
  403. console.log(row)
  404. if (this.checkStatus != '审核通过') {
  405. uni.showToast({
  406. title: "当前用户未授权,请联系客服",
  407. icon: "none",
  408. mask: true
  409. });
  410. return
  411. }
  412. // uni.$u.route('/pages/goods/details', {
  413. // id: item.id
  414. // });
  415. uni.navigateTo({
  416. url: '/pages/goods/details?id=' + row.id,
  417. });
  418. },
  419. opensalesman() {
  420. if (this.checkStatus != '审核通过') {
  421. uni.showToast({
  422. title: "当前用户未授权,请联系客服",
  423. icon: "none",
  424. mask: true
  425. });
  426. return
  427. }
  428. this.salesmanShow = true
  429. },
  430. swiperChange(e) {
  431. this.dotCurrent = e.detail.current;
  432. },
  433. inSetting() {
  434. uni.navigateTo({
  435. url: '/pages/home/setting'
  436. });
  437. },
  438. getAddressdata() {
  439. if (!uni.getStorageSync("addressData")) {
  440. getAddress().then(res => {
  441. uni.setStorageSync('addressData', JSON.stringify(res.data));
  442. })
  443. }
  444. },
  445. allClick(name) {
  446. this.$u.api.isDisable()
  447. if (name == '新建注册') {
  448. uni.navigateTo({
  449. url: '/pages/home/insurance/details'
  450. });
  451. }
  452. if (name == '轮胎保注册') {
  453. uni.navigateTo({
  454. url: '/pages/home/insurance/index'
  455. });
  456. }
  457. if (name == '保单') {
  458. uni.navigateTo({
  459. url: '/pages/home/claim/index'
  460. });
  461. }
  462. if (name == '商品检索') {
  463. uni.reLaunch({
  464. url: '/pages/goods/index'
  465. })
  466. }
  467. }
  468. }
  469. }
  470. </script>
  471. <style lang="scss" scoped>
  472. ::v-deep .uni-navbar--border {
  473. border-bottom-color: #03803B !important;
  474. }
  475. .container {
  476. position: relative;
  477. .background-image {
  478. position: absolute;
  479. /* 将图片置于组件后面 */
  480. }
  481. ::v-deep .uni-searchbar {
  482. background-color: #03803B !important;
  483. pointer-events: none !important;
  484. user-select: none !important;
  485. }
  486. .swiper-item {
  487. display: block;
  488. height: 300rpx;
  489. line-height: 300rpx;
  490. text-align: center;
  491. background-color: #FFFFFF;
  492. }
  493. .home-card {
  494. background-color: #fff;
  495. border-radius: 10rpx;
  496. overflow: hidden;
  497. margin: 20rpx;
  498. padding: 20rpx;
  499. .goodsImg {
  500. display: flex;
  501. flex-direction: column;
  502. align-items: center;
  503. justify-content: center;
  504. margin: 16rpx 0;
  505. .text {
  506. white-space: nowrap;
  507. overflow: hidden;
  508. text-overflow: ellipsis;
  509. width: 300rpx;
  510. text-align: center;
  511. font-size: 24rpx;
  512. color: #797979;
  513. }
  514. }
  515. .home-card-title {
  516. font-weight: 500;
  517. font-size: 34rpx;
  518. color: #0F0D0D;
  519. margin-left: 20rpx;
  520. margin-bottom: 10rpx;
  521. }
  522. ::v-deep .uni-grid-item {
  523. align-items: center;
  524. }
  525. .grid-item-box {
  526. display: flex;
  527. flex-direction: column;
  528. align-items: center;
  529. padding: 20rpx 0;
  530. .uni-grid-item__box {
  531. justify-content: center;
  532. }
  533. .grid-item-box-img {
  534. display: flex;
  535. justify-content: center;
  536. align-items: center;
  537. // width: 100rpx;
  538. // height: 100rpx;
  539. }
  540. .grid-item-box-text {
  541. width: 100rpx;
  542. text-align: center;
  543. font-weight: 500;
  544. font-size: 26rpx;
  545. color: #6A6A6A;
  546. }
  547. }
  548. }
  549. }
  550. .nav-right {
  551. width: 32rpx;
  552. height: 30rpx;
  553. }
  554. .suspensionBox {
  555. width: 80rpx;
  556. height: 80rpx;
  557. background: #fff;
  558. border-radius: 50%;
  559. position: fixed;
  560. bottom: 200rpx;
  561. right: 40rpx;
  562. box-shadow: 4px 4px 8px 1px rgba(0, 0, 0, .5);
  563. display: flex;
  564. align-items: center;
  565. justify-content: center;
  566. }
  567. .card {
  568. background-color: #fff;
  569. border-radius: 10rpx;
  570. overflow: hidden;
  571. margin: 12rpx 0;
  572. }
  573. .carBtn {
  574. display: flex;
  575. align-items: center;
  576. justify-content: center;
  577. color: #03803B;
  578. font-weight: bold;
  579. width: 25%;
  580. text-align: center;
  581. background-color: #fff;
  582. height: 64rpx;
  583. border-radius: 36rpx;
  584. margin-right: 20rpx;
  585. }
  586. .brandImg {
  587. display: flex;
  588. flex-direction: column;
  589. align-items: center;
  590. justify-content: center;
  591. margin: 16rpx 0;
  592. .text {
  593. white-space: nowrap;
  594. overflow: hidden;
  595. text-overflow: ellipsis;
  596. width: 140rpx;
  597. text-align: center;
  598. font-size: 24rpx;
  599. color: #797979;
  600. }
  601. }
  602. .goodsImg {
  603. display: flex;
  604. flex-direction: column;
  605. align-items: center;
  606. justify-content: center;
  607. margin: 16rpx 0;
  608. .text {
  609. white-space: nowrap;
  610. overflow: hidden;
  611. text-overflow: ellipsis;
  612. width: 300rpx;
  613. text-align: center;
  614. font-size: 24rpx;
  615. color: #797979;
  616. }
  617. }
  618. .container {
  619. position: relative;
  620. }
  621. .background-image {
  622. position: absolute;
  623. z-index: -1;
  624. /* 将图片置于组件后面 */
  625. }
  626. .imgIcon {
  627. position: absolute;
  628. width: 100rpx;
  629. height: 35rpx;
  630. top: 16rpx;
  631. right: 36rpx;
  632. }
  633. </style>