shopPage.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807
  1. <template>
  2. <view class="container">
  3. <view class="vheigh"></view>
  4. <scroll-view class="content-box" scroll-y="true">
  5. <view class="user-section">
  6. <view class="user-info-box ">
  7. <view class="detail flex" @click="navTo('/pages/set/userinfo')">
  8. <view class="portrait-box">
  9. <image class="portrait" :src="shopAction.image || '/static/error/shopErroe.png'"></image>
  10. </view>
  11. <view class="info-box">
  12. <view class="username">{{ shopAction.name?shopAction.name:'载入中'}}</view>
  13. <view class="authentication success">已认证</view>
  14. </view>
  15. </view>
  16. </view>
  17. </view>
  18. <view class="cover-container">
  19. <view class="tj-sction" v-if="type==1">
  20. <view class="tj-item" @click="navTo('./money/wallet')">
  21. <text>支付金额</text>
  22. <text class="num">{{ orderNum.todayPrice || '0' }}</text>
  23. <text>昨日:{{orderNum.proPrice}}</text>
  24. </view>
  25. <!-- <view class="tj-item" @click="navTo('/pages/user/award/award')">
  26. <text>会员数</text>
  27. <text class="num">{{ orderNum.proPrice || '0' }}</text>
  28. <text>昨日:{{orderNum.proPrice}}</text>
  29. </view> -->
  30. <view class="tj-item" @click="navTo('/pages/user/scoreAccumulate')">
  31. <text>支付订单数</text>
  32. <text class="num">{{ orderNum.todayCount || '0' }}</text>
  33. <text>昨日:{{orderNum.proCount}}</text>
  34. </view>
  35. </view>
  36. <!-- 订单 -->
  37. <view class="item-box">
  38. <view class="box-title flex">
  39. <view class="title"><text>店铺订单</text></view>
  40. <!-- <view class="link" @click="navTo('/pages/shop/shopOrder?state=0')" hover-class="common-hover">
  41. <text>全部</text>
  42. <text class="iconfont iconenter"></text>
  43. </view> -->
  44. </view>
  45. <view class="order-section">
  46. <view class="order-item" @click="navTo('/pages/shop/shopOrder?state=0')"
  47. hover-class="common-hover" :hover-stay-time="50">
  48. <view class=" icon position-relative">
  49. <view class="numOrderItem font-color-gray">
  50. {{orderNum.unpaid_count}}
  51. </view>
  52. </view>
  53. <text>待付款</text>
  54. </view>
  55. <view class="order-item" @click="navTo('/pages/shop/shopOrder?state=1')"
  56. hover-class="common-hover" :hover-stay-time="50">
  57. <view class=" icon position-relative">
  58. <view class="numOrderItem font-color-red">
  59. {{orderNum.unshipped_count}}
  60. </view>
  61. </view>
  62. <text>待发货</text>
  63. </view>
  64. <view class="order-item" @click="navTo('/pages/shop/shopOrder?state=2')"
  65. hover-class="common-hover" :hover-stay-time="50">
  66. <view class="icon position-relative">
  67. <view class="numOrderItem font-color-gray">
  68. {{orderNum.received_count}}
  69. </view>
  70. </view>
  71. <text>已发货</text>
  72. </view>
  73. <!-- <view class="order-item" @click="navTo('/pages/shop/shopOrderAfter?state=3')"
  74. hover-class="common-hover" :hover-stay-time="50">
  75. <view class="icon position-relative">
  76. <view class="numOrderItem font-color-yellow">
  77. {{orderNum.refund_count}}
  78. </view>
  79. </view>
  80. <text>待售后</text>
  81. </view> -->
  82. </view>
  83. </view>
  84. <view class="listBox">
  85. <view class="list">
  86. <view class="flex listItem" @click="smsh">
  87. <view class="flex titleBox">
  88. <image class="listIconImg" src="../../static/icon/mySet.png" mode="widthFix"></image>
  89. <text class="title">核销</text>
  90. </view>
  91. <view class="right flex">
  92. <text></text>
  93. <!-- <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image> -->
  94. </view>
  95. </view>
  96. <!-- <view class="flex listItem" @click="navTo('/pages/shop/repair/clientRepair')" v-if="type==1">
  97. <view class="flex titleBox">
  98. <image class="listIconImg" src="../../static/icon/myWx.png" mode="widthFix"></image>
  99. <text class="title">客户报修</text>
  100. </view>
  101. <view class="right flex" v-if="question>0">
  102. <text class="numbox">{{question}}</text>
  103. </view>
  104. </view> -->
  105. <!-- <view class="flex listItem" @click="navTo('/pages/shop/repair/repairHistory')">
  106. <view class="flex titleBox">
  107. <image class="listIconImg" src="../../static/icon/myWx.png" mode="widthFix"></image>
  108. <text class="title">维修历史</text>
  109. </view>
  110. </view> -->
  111. <!-- <view class="flex listItem" @click="navTo('/pages/set/set')">
  112. <view class="flex titleBox">
  113. <image class="listIconImg" src="../../static/icon/shopMoney.png" mode="widthFix">
  114. </image>
  115. <text class="title">店铺钱包</text>
  116. </view>
  117. <view class="right flex">
  118. <text></text>
  119. </view>
  120. </view> -->
  121. <!-- <view class="flex listItem" @click="navTo('/pages/shop/repair/taskClientRepair')">
  122. <view class="flex titleBox">
  123. <image class="listIconImg" src="../../static/icon/myWx.png" mode="widthFix"></image>
  124. <text class="title">维修任务</text>
  125. </view>
  126. <view class="right flex" v-if="tesk>0">
  127. <text class="numbox">{{tesk}}</text>
  128. </view>
  129. </view> -->
  130. <!-- <view class="flex listItem" @click="navTo('/pages/set/set')">
  131. <view class="flex titleBox">
  132. <image class="listIconImg" src="../../static/icon/myServer.png" mode="widthFix"></image>
  133. <text class="title">联系平台</text>
  134. </view>
  135. <view class="right flex">
  136. <text></text>
  137. </view>
  138. </view> -->
  139. <view class="flex listItem" @click="navTo('/pages/set/set')">
  140. <view class="flex titleBox">
  141. <image class="listIconImg" src="../../static/icon/mySet.png" mode="widthFix"></image>
  142. <text class="title">设置</text>
  143. </view>
  144. <view class="right flex">
  145. <text></text>
  146. <!-- <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image> -->
  147. </view>
  148. </view>
  149. </view>
  150. </view>
  151. <view class="tapBottom" @click="changeTab">
  152. 前往用户界面
  153. </view>
  154. </view>
  155. </scroll-view>
  156. <!-- 核销弹窗 -->
  157. <uni-popup ref="popuphx" class="agree-wrapper">
  158. <view class="hx-wrapper">
  159. <view class="hx-img">
  160. <image src="../../static/img/hxbg.png" mode=""></image>
  161. </view>
  162. <view class="hx-body">
  163. <view class="nav-hx">
  164. <view class="action" style="text-align: center;">
  165. {{hxtype == 0?'商品核销':(hxtype == 1 ? '电池核销': '升压器核销') }}</view>
  166. </view>
  167. <!-- <view class="hx-title">
  168. 核销码
  169. </view> -->
  170. <input type="text" v-model="code" placeholder="请输入核销码" placeholder-class="hx-placeholder" />
  171. <view class="flex dcm" v-if="hxtype == 1 || hxtype == 2">
  172. <input type="text" v-model="dcode" :placeholder="hxtype == 1? '请输入电池编号': '请输入升压器编号'"
  173. placeholder-class="hx-placeholder" style="margin-bottom: 0;" />
  174. <image src="../../static/icon/scend.png" mode="widthFix" style="width: 50rpx;" @click="smdc">
  175. </image>
  176. </view>
  177. <view class="hx-btn" @click="qhx">
  178. 立即核销
  179. </view>
  180. </view>
  181. <view class="hx-close" @click="close">
  182. <image src="../../static/icon/close.png" mode=""></image>
  183. </view>
  184. </view>
  185. </uni-popup>
  186. </view>
  187. </template>
  188. <script>
  189. // #ifdef H5
  190. import weixinObj from "@/plugin/jweixin-module/index.js";
  191. // #endif
  192. import {
  193. mapState,
  194. mapMutations
  195. } from 'vuex';
  196. import {
  197. statistics,
  198. funds,
  199. question,
  200. adminStore,
  201. task
  202. } from '@/api/shop.js';
  203. import {rentVerific,orderVerific} from '@/api/index.js'
  204. import {
  205. saveUrl,
  206. interceptor
  207. } from '@/utils/loginUtils.js';
  208. export default {
  209. data() {
  210. return {
  211. hxtype: 0,
  212. code: '',
  213. dcode: '',
  214. type: 0, //0为数据未加载,1为门店2为店员
  215. orderNum: {
  216. unpaid_count: 0, //待支付
  217. unshipped_count: 0, //待发货
  218. received_count: 0, //待收获
  219. refund_count: 0, //待售后
  220. todayPrice: 0, //今日成交额
  221. todayCount: 0, //今日订单数
  222. proPrice: 0, //昨日成交额
  223. proCount: 0, //昨日订单数
  224. },
  225. question: 0, //维修数量
  226. tesk: 0, //维修任务数量
  227. };
  228. },
  229. computed: {
  230. ...mapState('user', ['hasLogin']),
  231. ...mapState('shop', ['shopAction'])
  232. },
  233. created() {
  234. this.type = this.shopAction.type
  235. },
  236. methods: {
  237. ...mapMutations('shop', ['setShopAction']),
  238. smdc() {
  239. let that = this
  240. // #ifndef H5
  241. uni.scanCode({
  242. autoDecodeCharset: true,
  243. success: (res) => {
  244. if (that.hxtype == 1) {
  245. console.log(res);
  246. let str = res.result.split('编号:')
  247. this.dcode = str[1]
  248. } else {
  249. this.dcode = res.result
  250. }
  251. }
  252. })
  253. // #endif
  254. },
  255. qhx() {
  256. let that = this
  257. if (that.hxLoading) {
  258. return
  259. }
  260. if (that.code == '') {
  261. return that.$api.msg('请输入核销码')
  262. }
  263. if (that.hxtype == 0) {
  264. that.hxLoading = true
  265. orderVerific({
  266. verify_code: that.code,
  267. is_confirm: 1
  268. }).then(res => {
  269. uni.showToast({
  270. title: '核销成功',
  271. mask: true,
  272. duration: 1500
  273. });
  274. that.close()
  275. that.hxLoading = false
  276. }).catch(err => [
  277. that.hxLoading = false
  278. ])
  279. } else {
  280. if (that.dcode == '') {
  281. return that.$api.msg('请输入编号')
  282. }
  283. that.hxLoading = false
  284. let qdata = {
  285. verify_code: that.code,
  286. is_confirm: 1
  287. }
  288. if(that.hxtype == 1) {
  289. qdata.battery_number = that.dcode
  290. }else {
  291. qdata.booster_number = that.dcode
  292. }
  293. rentVerific(qdata).then(res => {
  294. uni.showToast({
  295. title: '核销成功',
  296. mask: true,
  297. duration: 1500
  298. });
  299. that.close()
  300. that.hxLoading = false
  301. })
  302. }
  303. },
  304. openHx() {
  305. this.$refs.popuphx.open()
  306. },
  307. close() {
  308. this.code = ''
  309. this.dcode = ''
  310. this.$refs.popuphx.close()
  311. },
  312. // 扫码
  313. smsh() {
  314. let that = this
  315. uni.showActionSheet({
  316. itemList: ['商品核销', '电池核销', '升压器核销'],
  317. success: function(res) {
  318. console.log(res, '上传')
  319. that.hxtype = res.tapIndex
  320. console.log();
  321. that.openHx();
  322. // #ifdef H5
  323. try {
  324. weixinObj.scanQRCode({
  325. needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
  326. scanType: ["qrCode", "barCode"], // 可以指定扫二维码还是一维码,默认二者都有
  327. success: function(res) {
  328. var result = res.resultStr; // 当needResult 为 1 时,扫码返回的结果
  329. let arr = result.split('&');
  330. if (that.hxtype == 0) {
  331. that.code = arr[0];
  332. } else {
  333. that.code = arr[1]
  334. that.dcode = arr[2]
  335. }
  336. that.openHx();
  337. },
  338. false(err) {
  339. console.log('shib');
  340. that.openHx();
  341. }
  342. });
  343. } catch (err) {
  344. that.openHx();
  345. }
  346. // #endif
  347. // #ifndef H5
  348. uni.scanCode({
  349. success: (res) => {
  350. let result = res.result
  351. let arr = result.split('&')
  352. if (that.hxtype == 0) {
  353. that.code = arr[0];
  354. } else {
  355. that.code = arr[1]
  356. that.dcode = arr[2]
  357. }
  358. that.openHx();
  359. }
  360. })
  361. // #endif
  362. },
  363. fail: function(res) {
  364. // erro(res)
  365. console.log(res.errMsg);
  366. }
  367. });
  368. },
  369. // 重新加载数据
  370. getInit() {
  371. const that = this;
  372. // 订单数
  373. statistics().then((e) => {
  374. that.orderNum = e.data
  375. })
  376. // 门店资金
  377. funds().then((e) => {
  378. that.name = e.data.name;
  379. that.logo = e.data.image;
  380. // 保存商店数据
  381. if (e.data.address) {
  382. e.data.type = 1;
  383. that.setShopAction(e.data);
  384. } else {
  385. e.data.type = 2;
  386. adminStore().then((ar) => {
  387. that.setShopAction(ar.data);
  388. }).catch((e) => {
  389. console.log(e);
  390. })
  391. }
  392. that.type = e.data.type;
  393. })
  394. // 查询店长客户报修数量
  395. question().then((e) => {
  396. that.question = e.data.count
  397. })
  398. // 查询维修任务数量
  399. task().then((e) => {
  400. that.tesk = e.data.count;
  401. }).catch((e) => {
  402. console.log(e);
  403. })
  404. },
  405. // 界面切换
  406. changeTab() {
  407. this.$emit('tab', false)
  408. },
  409. navTo(url) {
  410. if (!this.hasLogin) {
  411. // 保存地址
  412. saveUrl();
  413. // 登录拦截
  414. interceptor();
  415. } else {
  416. uni.navigateTo({
  417. url
  418. });
  419. }
  420. },
  421. }
  422. };
  423. </script>
  424. <style lang="scss">
  425. page {
  426. height: 100%;
  427. }
  428. .tapBottom {
  429. margin: 0 50rpx;
  430. text-align: center;
  431. color: #FFFFFF;
  432. border: 1px solid $color-green;
  433. background-color: $color-green ;
  434. line-height: 1;
  435. padding: 25rpx;
  436. border-radius: 100rpx;
  437. margin-top: 50rpx;
  438. }
  439. .listBox {
  440. margin-top: 20rpx;
  441. background-color: #FFFFFF;
  442. border-radius: 20rpx;
  443. overflow: hidden;
  444. }
  445. .list {
  446. .listItem {
  447. padding: 35rpx 40rpx;
  448. border-bottom: 1px solid $page-color-light;
  449. }
  450. .listIconImg {
  451. width: 36rpx;
  452. height: 36rpx;
  453. }
  454. .right {
  455. .img {
  456. width: 26rpx;
  457. }
  458. .numbox {
  459. background-color: $color-red;
  460. color: #FFFFFF;
  461. font-size: 22rpx;
  462. border-radius: 100rpx;
  463. min-width: 36rpx;
  464. height: 36rpx;
  465. line-height: 36rpx;
  466. text-align: center;
  467. padding: 0 5rpx;
  468. }
  469. }
  470. .titleBox {
  471. .title {
  472. padding-left: 20rpx;
  473. color: $font-color-base;
  474. font-size: $font-base;
  475. }
  476. }
  477. }
  478. %flex-center {
  479. display: flex;
  480. flex-direction: column;
  481. justify-content: center;
  482. align-items: center;
  483. }
  484. %section {
  485. display: flex;
  486. justify-content: space-around;
  487. align-content: center;
  488. border-radius: 10rpx;
  489. }
  490. .container {
  491. height: 100%;
  492. background-color: $page-color-base;
  493. }
  494. .content-box {
  495. height: 100%;
  496. }
  497. .vheigh {
  498. height: var(--status-bar-height);
  499. }
  500. .user-section {
  501. padding: 15rpx 30rpx 0;
  502. position: relative;
  503. }
  504. .user-info-box {
  505. height: 180rpx;
  506. color: white;
  507. display: flex;
  508. align-items: center;
  509. justify-content: space-between;
  510. position: relative;
  511. z-index: 1;
  512. .detail {
  513. height: 130rpx;
  514. .portrait-box {
  515. height: 100%;
  516. .portrait {
  517. width: 130rpx;
  518. height: 100%;
  519. border: 5rpx solid #fff;
  520. border-radius: 50%;
  521. }
  522. }
  523. .info-box {
  524. margin-left: 20rpx;
  525. line-height: 1.5;
  526. .username {
  527. font-size: 40rpx;
  528. color: $font-color-dark;
  529. font-weight: bold;
  530. height: 100%;
  531. }
  532. .authentication {
  533. border: 2rpx solid #FF4241;
  534. border-radius: 20px;
  535. padding: 0 25rpx;
  536. font-size: 24rpx;
  537. color: #FF4241;
  538. float: left;
  539. &.success {
  540. border: 2rpx solid $color-green;
  541. color: $color-green;
  542. }
  543. }
  544. }
  545. }
  546. }
  547. .cover-container {
  548. padding: 0 30rpx;
  549. position: relative;
  550. padding-bottom: 20rpx;
  551. }
  552. .tj-sction {
  553. @extend %section;
  554. .tj-item {
  555. @extend %flex-center;
  556. flex-direction: column;
  557. height: 100rpx;
  558. font-size: $font-sm;
  559. color: $font-color-light;
  560. }
  561. .num {
  562. font-size: $font-base;
  563. color: $font-color-dark;
  564. margin-bottom: 8rpx;
  565. font-weight: bold;
  566. }
  567. }
  568. .item-box {
  569. border-radius: 20rpx;
  570. background-color: white;
  571. margin-top: 20rpx;
  572. .box-title {
  573. line-height: 1;
  574. padding: 30rpx;
  575. .title {
  576. font-size: $font-lg;
  577. font-weight: bold;
  578. }
  579. .link {
  580. font-size: $font-base - 2rpx;
  581. color: $font-color-light;
  582. }
  583. }
  584. .order-section {
  585. @extend %section;
  586. padding: 28rpx 0;
  587. padding-top: 0;
  588. .order-item {
  589. @extend %flex-center;
  590. width: 120rpx;
  591. height: 120rpx;
  592. border-radius: 10rpx;
  593. font-size: $font-sm;
  594. color: $font-color-dark;
  595. .numOrderItem {
  596. font-size: 36rpx;
  597. font-weight: bold;
  598. text-align: center;
  599. }
  600. }
  601. .iconfont {
  602. font-size: 48rpx;
  603. margin-bottom: 18rpx;
  604. color: #fa436a;
  605. }
  606. .icon-shouhoutuikuan {
  607. font-size: 44rpx;
  608. }
  609. .icon {
  610. height: 50rpx;
  611. width: 48rpx;
  612. margin-bottom: 18rpx;
  613. background-size: 100%;
  614. background-repeat: no-repeat;
  615. background-position: center;
  616. .icon-img {
  617. width: 100%;
  618. height: 100%;
  619. }
  620. }
  621. }
  622. }
  623. .history-section {
  624. // padding: 30rpx 0 0;
  625. margin-top: 20rpx;
  626. background: #fff;
  627. border-radius: 10rpx;
  628. .h-list {
  629. white-space: nowrap;
  630. padding: 30rpx 30rpx 0;
  631. .h-list-image {
  632. display: inline-block;
  633. width: 160rpx;
  634. height: 160rpx;
  635. margin-right: 20rpx;
  636. border-radius: 10rpx;
  637. }
  638. }
  639. }
  640. .hx-wrapper {
  641. width: 536rpx;
  642. // height: 630rpx;
  643. position: relative;
  644. padding-bottom: 40rpx;
  645. background-color: #fff;
  646. border-radius: 20rpx;
  647. .hx-img {
  648. width: 536rpx;
  649. height: 281rpx;
  650. image {
  651. width: 536rpx;
  652. height: 281rpx;
  653. }
  654. }
  655. .hx-close {
  656. position: absolute;
  657. left: 243rpx;
  658. bottom: -80rpx;
  659. width: 52rpx;
  660. height: 52rpx;
  661. image {
  662. width: 52rpx;
  663. height: 52rpx;
  664. }
  665. }
  666. .hx-body {
  667. width: 536rpx;
  668. // min-height: 349rpx;
  669. background-color: #fff;
  670. border-radius: 0 0 10rpx 10rpx;
  671. padding-top: 40rpx;
  672. .hx-title {
  673. width: 536rpx;
  674. font-size: 36rpx;
  675. font-weight: 500;
  676. color: #333333;
  677. line-height: 1;
  678. padding-top: 42rpx;
  679. text-align: center;
  680. padding-bottom: 10rpx;
  681. }
  682. input {
  683. width: 439rpx;
  684. height: 68rpx;
  685. background: #f1faf6;
  686. border-radius: 10rpx;
  687. margin: 0 auto 40rpx;
  688. padding-left: 26rpx;
  689. .hx-placeholder {
  690. font-size: 26rpx;
  691. font-weight: 500;
  692. color: $base-color;
  693. }
  694. }
  695. .hx-btn {
  696. margin: 44rpx auto 0;
  697. width: 353rpx;
  698. height: 71rpx;
  699. background: $base-color;
  700. border-radius: 34rpx;
  701. font-size: 36rpx;
  702. font-weight: 500;
  703. color: #F8F9F9;
  704. line-height: 71rpx;
  705. text-align: center;
  706. }
  707. }
  708. }
  709. .dcm {
  710. width: 439rpx;
  711. margin: 0 auto;
  712. align-items: center;
  713. height: 68rpx;
  714. input {
  715. flex-grow: 1;
  716. height: 68rpx;
  717. background: #f1faf6;
  718. border-radius: 10rpx;
  719. margin: auto 10rpx auto 0;
  720. padding-left: 26rpx;
  721. }
  722. image {
  723. flex-shrink: 0;
  724. }
  725. }
  726. .nav-hx {
  727. display: flex;
  728. justify-content: center;
  729. margin-bottom: 20rpx;
  730. text {
  731. font-size:28rpx;
  732. padding: 10rpx;
  733. }
  734. .action {
  735. color: $base-color;
  736. font-weight: bold;
  737. }
  738. }
  739. </style>