index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587
  1. <template>
  2. <view v-if="isShowView">
  3. <view class="top">
  4. <!-- 背景 -->
  5. <image src="../merchant/static/images/bg.png" alt class="bg" />
  6. <!-- 用戶信息 -->
  7. <view class="minec">
  8. <image :src="merchant.logo" v-if="merchant.logo" mode="aspectFill" class="user" />
  9. <image v-else src="../merchant/static/images/user.png" mode="aspectFill" class="user" />
  10. <view class="mines">
  11. <view class="mines_top">
  12. <view class="title">{{ merchant.title }}</view>
  13. </view>
  14. <view class="edu">编号:{{ merchant.id }}</view>
  15. </view>
  16. </view>
  17. <view class="ssbox dflex">
  18. <view class="search dflex">
  19. <image src="../merchant/static/images/ssico.png"></image>
  20. <input placeholder="请输入订单号、客户手机号后4位、提货码" class="flex" :value="searchTitle" @input="onSearch" @confirm="confirm" confirm-type="search" />
  21. <image src="../merchant/static/images/clear.png" @tap="clearInput" v-if="searchTitle != ''"></image>
  22. </view>
  23. </view>
  24. </view>
  25. <view class="data">
  26. <view class="order">
  27. <view class="list1">
  28. <view class="li" @click="toOrderList(3)">
  29. <view class="">
  30. <image src="../merchant/static/images/ddcx.png" class="orderimage" />
  31. <view class="start">订单</view>
  32. </view>
  33. </view>
  34. <view class="li" @click="jumpUrl('/merchant/write/index?merchantId='+form.merchantId)">
  35. <view class="">
  36. <image src="../merchant/static/images/hexiao.png" class="orderimage" />
  37. <view class="start">核销</view>
  38. </view>
  39. </view>
  40. <view class="li" @click="toScanCode()">
  41. <view class="">
  42. <image src="../merchant/static/images/sys.png" class="orderimage" />
  43. <view class="start">扫一扫</view>
  44. </view>
  45. </view>
  46. <!-- <view class="li">
  47. <view class="" @click="jumpUrl('/valet/index/index')">
  48. <image src="../merchant/static/images/dkxd.png" class="orderimage" />
  49. <view class="start">代客下单</view>
  50. </view>
  51. </view> -->
  52. <view class="li" @click="jumpUrl('/payment/receiveCode/receiveCode')">
  53. <view class="">
  54. <image src="../merchant/static/images/skm.png" class="orderimage" />
  55. <view class="start">收款码</view>
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. </view>
  61. <view class="data">
  62. <!-- 订单 -->
  63. <view class="order">
  64. <!-- <view url="/mine/order/order" hover-class="none" class="tits dflex"> -->
  65. <view @click="toOrderList(4)" class="tits dflex">
  66. <view class="flex">我的订单</view>
  67. 查看全部
  68. <image src="../merchant/static/images/drop-right.png" class="rico"></image>
  69. </view>
  70. <view class="list1">
  71. <view class="li" @click="toOrderList(0)">
  72. <view class="cont">
  73. <image src="../merchant/static/images/activityOrder.png" class="orderimage" />
  74. <text class="dots" v-if="statistics && statistics.t3 > 0">{{ statistics.t3 }}</text>
  75. <view class="start">待发货</view>
  76. </view>
  77. </view>
  78. <view class="li" @click="toOrderList(1)">
  79. <view class="cont">
  80. <image src="../merchant/static/images/ddico0.png" class="orderimage" />
  81. <text class="dots" v-if="statistics && statistics.toBeWrittenOff > 0">{{ statistics.toBeWrittenOff }}</text>
  82. <view class="start">待核销</view>
  83. </view>
  84. </view>
  85. <view class="li" @click="toOrderList(2)">
  86. <view class="cont">
  87. <image src="../merchant/static/images/deliveredOrder.png" class="orderimage" />
  88. <text class="dots" v-if="statistics && statistics.t4 > 0">{{ statistics.t4 }}</text>
  89. <view class="start">待提货</view>
  90. </view>
  91. </view>
  92. <view class="li" @click="toOrderList(3)">
  93. <view class="">
  94. <image src="../merchant/static/images/refundOrder.png" class="orderimage" />
  95. <text class="dots" v-if="statistics && statistics.t12 > 0">{{ statistics.t12 }}</text>
  96. <view class="start">退款/售后</view>
  97. </view>
  98. </view>
  99. </view>
  100. </view>
  101. </view>
  102. <view class="lists">
  103. <ul class="list">
  104. <li v-for="(item, index) in pageLists" :key="index">
  105. <view class="ddbh dflex" @click="toOrederDel(item.id)">
  106. <view class="ordid">
  107. <image src="../merchant/static/images/ziti.png" class="ziti" v-if="item.mode == 1" />
  108. <image src="../merchant/static/images/youji.png" class="youji" v-if="item.mode == 2" />
  109. <image src="../merchant/static/images/jishida.png" class="jsd" v-if="item.mode == 3" />
  110. {{ item.id }}
  111. </view>
  112. <view class="flex dflex right ddddd">
  113. <!-- <block v-if="item.state == 4 && (item.orderType == 17 || item.orderType == 18)"></block>
  114. <block v-else>
  115. <view class="th-code red" v-if="item.mode === 1">
  116. 提货码:
  117. <text>{{ item.code }}</text>
  118. </view>
  119. </block> -->
  120. <image src="../merchant/static/images/jishidaioc.png" class="type" v-if="item.orderType === 5" />
  121. <image src="../merchant/static/images/tuangou.png" class="type" v-if="item.orderType === 2" />
  122. <image src="../merchant/static/images/pingtuan.png" class="type" v-if="item.orderType == 4" />
  123. <image src="../merchant/static/images/seckill.png" class="type" v-if="item.orderType == 3" />
  124. <image src="../merchant/static/images/newbornZone.png" class="type" v-if="item.orderType == 6" />
  125. <image src="../merchant/static/images/kanjia.png" class="type" v-if="item.orderType == 7" />
  126. </view>
  127. </view>
  128. <view class="lis" v-for="(pro, ind) in item.products" :key="ind" @click="toOrederDel(item.id)">
  129. <image :src="pro.pic" class="cimage" />
  130. <view class="zhinfo">
  131. <view class="zhtit" v-text="pro.title"></view>
  132. <view class="jiage">
  133. <view class="price">
  134. <span>¥</span>
  135. {{ pro.salePrice }}
  136. </view>
  137. <view class="num">×{{ pro.quantity }}</view>
  138. </view>
  139. </view>
  140. </view>
  141. <view class="total" @click="toOrederDel(item.id)">
  142. <view>共{{ item.count }}件</view>
  143. <view>
  144. 总计:
  145. <span>¥{{ item.money }}</span>
  146. </view>
  147. </view>
  148. <view class="status">
  149. <block v-if="item.state == 4 && (item.orderType == 17 || item.orderType == 18)"><view class="flex">待核销</view></block>
  150. <span v-else class="ordidss flex">{{ item.stateName }}</span>
  151. <view class="sta-btn" v-if="merchant.printer != 0 && (item.state == 3 || item.state == 4)" @click="orderPrinting(item.id, index)">打印小票</view>
  152. <!-- <view class="sta-btn" v-if="item.state > 29 && item.state < 41 && item.state != 32" @click="jumpUrl('refundDetail?id=' + item.id)">审核</view> -->
  153. <view class="sta-btn" v-if="item.state == 3" @click="deliverGoods(item.id, merchant.id, item.orderType)">确认发货</view>
  154. <block v-if="item.orderType != 17 && item.orderType != 18">
  155. <view class="sta-btn" v-if="item.state === 4" @click="send(item.id)">通知取件</view>
  156. <view class="sta-btn" v-if="item.state === 4" @click="deliver(item.id, index)">提货</view>
  157. </block>
  158. <block v-else>
  159. <view class="sta-btn" v-if="item.state === 4" @click="deliver(item.id, index)">核销</view>
  160. </block>
  161. </view>
  162. </li>
  163. </ul>
  164. </view>
  165. <div class="datas">
  166. <h3 class="tit">经营简报</h3>
  167. <div class="dflex">
  168. <ul>
  169. <li>
  170. <span>{{ statistics.dTotal ? statistics.dTotal : '0' }}/{{ statistics.yTotal ? statistics.yTotal : '0' }}</span>
  171. 今日订单/昨日订单
  172. </li>
  173. <li>
  174. <span>{{ statistics.wTotal ? statistics.wTotal : '0' }}</span>
  175. 本周订单
  176. </li>
  177. <li>
  178. <span>{{ statistics.mTotal ? statistics.mTotal : '0' }}</span>
  179. 本月订单
  180. </li>
  181. </ul>
  182. <ul>
  183. <li>
  184. <span>{{ statistics.dMoney ? statistics.dMoney : '0' }}/{{ statistics.yMoney ? statistics.yMoney : '0' }}</span>
  185. 今日营业额/昨日营业额
  186. </li>
  187. <li>
  188. <span>{{ statistics.wMoney ? statistics.wMoney : '0' }}</span>
  189. 本周营业额
  190. </li>
  191. <li>
  192. <span>{{ statistics.mMoney ? statistics.mMoney : '0' }}</span>
  193. 本月营业额
  194. </li>
  195. </ul>
  196. </div>
  197. </div>
  198. </view>
  199. </template>
  200. <script>
  201. const req = require('../utils/request');
  202. export default {
  203. // inject: ['getMerchant', 'getToken'],
  204. data() {
  205. return {
  206. searchTitle: '',
  207. appId: '',
  208. token: '',
  209. isShowView: false,
  210. statistics: {},
  211. merchant: '',
  212. form: {
  213. page: 1,
  214. limit: 100,
  215. merchantId: null,
  216. isToDay: false
  217. },
  218. isLoad: true,
  219. isFrist: true,
  220. pageLists: ''
  221. };
  222. },
  223. onLoad(opt) {
  224. this.getMy();
  225. },
  226. onShow() {
  227. if (!this.isFrist) {
  228. this.form.page = 1;
  229. this.isLoad = true;
  230. this.getOrderList();
  231. }
  232. },
  233. methods: {
  234. jumpUrl(url) {
  235. uni.navigateTo({
  236. url: url
  237. });
  238. },
  239. toScanCode() {
  240. var tah = this;
  241. uni.scanCode({
  242. success: function(res) {
  243. // console.log('条码类型:' + res.scanType);
  244. // console.log('条码内容:', res);
  245. tah.paymentUserInfoRequest(res.path);
  246. }
  247. });
  248. },
  249. paymentUserInfoRequest(coderesult) {
  250. req.getRequest('/api/v3/payment/user/info/scan', { code: coderesult.split('=')[1] }, data => {
  251. req.setStorage('paymentUserInfo_key', data);
  252. // uni.navigateTo({
  253. // url: '/merchant/scanPay?code=' + coderesult
  254. // });
  255. uni.navigateTo({
  256. url: '/' + coderesult
  257. });
  258. });
  259. },
  260. getMy() {
  261. req.getRequest('/api/user/my', {}, resp => {
  262. if (resp.listShopBase && resp.listShopBase.length > 0) {
  263. this.form.merchantId = resp.listShopBase[0].id;
  264. } else if (resp.listMerchant && resp.listMerchant.length > 0) {
  265. this.form.merchantId = resp.listMerchant[0].id;
  266. } else if (resp.merchantId) {
  267. this.form.merchantId = resp.merchantId;
  268. }
  269. this.merchantDetail();
  270. this.getstatistics(resp);
  271. this.getOrderList();
  272. });
  273. },
  274. // 店铺详情
  275. merchantDetail() {
  276. let fromP = {};
  277. fromP.id = this.form.merchantId;
  278. req.getRequest('/api/merchant/detail', fromP, data => {
  279. this.merchant = data;
  280. });
  281. },
  282. // 门店统计
  283. getstatistics(data) {
  284. let from = {};
  285. if (data.listShopBase && data.listShopBase != null && data.listShopBase.length > 0) {
  286. from.shopId = data.listShopBase[0].id;
  287. }
  288. if (data.listMerchant && data.listMerchant != null && data.listMerchant.length > 0 && data.listShopBase.length < 1) {
  289. from.merchantId = data.listMerchant[0].id;
  290. }
  291. req.getRequest(
  292. '/api/order/statistics',
  293. from,
  294. data => {
  295. this.statistics = data;
  296. this.isShowView = true;
  297. },
  298. this.isFrist
  299. );
  300. },
  301. // 获取订单列表
  302. getOrderList() {
  303. if (!this.isLoad) {
  304. return false;
  305. }
  306. this.isLoad = false;
  307. let form = this.form;
  308. req.getRequest(
  309. '/api/order/merchant/list',
  310. form,
  311. data => {
  312. if (this.form.page == 1) {
  313. this.pageLists = [];
  314. }
  315. data = data.filter(
  316. ele => ele.state == 3 || ele.state == 4 || ele.state == 30 || ele.state == 31 || ele.state == 36 || ele.state == 39 || ele.state == 40 || ele.state == 36
  317. );
  318. this.isLoad = true;
  319. if (data && data.length > 0) {
  320. this.pageLists = data.slice(0, 3);
  321. }
  322. this.isShowView = true;
  323. this.isFrist = false;
  324. },
  325. this.isFrist
  326. );
  327. },
  328. // 搜索订单 获取用户输入的内容
  329. onSearch(e) {
  330. this.searchTitle = e.detail.value;
  331. },
  332. //清除输入框
  333. clearInput() {
  334. this.searchTitle = '';
  335. },
  336. // 搜索订单
  337. confirm() {
  338. let value = this.searchTitle;
  339. uni.navigateTo({
  340. url: 'search?searchValue=' + value + '&merchantId=' + this.merchant.id
  341. });
  342. },
  343. // 查看订单详情
  344. toOrederDel(id) {
  345. this.jumpUrl('show?id=' + id + '&merchantId=' + this.merchant.id);
  346. },
  347. // 跳转订单列表
  348. toOrderList(index) {
  349. uni.navigateTo({
  350. url: 'order?merchantId=' + this.merchant.id + '&tabIndex=' + index
  351. });
  352. },
  353. // 打印
  354. orderPrinting(id, index) {
  355. req.getRequest(
  356. '/api/merchant/printOrderInfo',
  357. id,
  358. data => {
  359. req.msg(data.msg);
  360. },
  361. true
  362. );
  363. },
  364. // 确认发货
  365. deliverGoods(id, merchantId, orderType) {
  366. this.jumpUrl('expressList/index?id=' + id + '&merchantId=' + merchantId + '&orderType=' + orderType);
  367. // req.postRequest(
  368. // '/api/order/deliverExtend',
  369. // {
  370. // id: id
  371. // },
  372. // res => {
  373. // if (res && res.length > 1) {
  374. // this.jumpUrl('deliverExtend?id=' + id + '&merchantId=' + merchantId + '&orderType=' + orderType);
  375. // }
  376. // if (res && res.length <= 1) {
  377. // this.jumpUrl('express?id=' + id + '&merchantId=' + merchantId + '&orderType=' + orderType);
  378. // }
  379. // },
  380. // true
  381. // );
  382. },
  383. // 通知取件
  384. send(id) {
  385. req.getRequest(
  386. '/api/wxmes/send',
  387. {
  388. orderId: id,
  389. bsusinessType: 11
  390. },
  391. data => {
  392. req.msg('通知成功');
  393. },
  394. true
  395. );
  396. },
  397. // 已提货
  398. deliver(id, index) {
  399. req.postRequest(
  400. '/api/order/confirm',
  401. {
  402. id: id,
  403. mode: '1'
  404. },
  405. data => {
  406. this.pageList[index].state = 7;
  407. this.pageList[index].stateName = '已核销';
  408. },
  409. true
  410. );
  411. }
  412. }
  413. };
  414. </script>
  415. <style scoped>
  416. @import './static/css/main.css';
  417. .expressinfo {
  418. display: flex;
  419. justify-content: space-between;
  420. margin-bottom: 10px;
  421. }
  422. /* #main {
  423. padding: 15px
  424. } */
  425. .histogram {
  426. margin: 0.2rem;
  427. background: #fff;
  428. border-radius: 7px;
  429. position: relative;
  430. }
  431. .histogramDay {
  432. position: absolute;
  433. right: 15px;
  434. top: 14px;
  435. z-index: 1;
  436. }
  437. .histogramDay image {
  438. width: 9px;
  439. height: 6px;
  440. margin: 0 0 2px 0;
  441. }
  442. .orderimage {
  443. width: 25px;
  444. height: 26px;
  445. margin-bottom: 10px;
  446. }
  447. .rico {
  448. width: 6px;
  449. height: 9px;
  450. margin-left: 5px;
  451. margin-bottom: 2px;
  452. }
  453. .tits {
  454. font-size: 12px;
  455. color: #999;
  456. align-items: center;
  457. height: 40px;
  458. line-height: 40px;
  459. position: relative;
  460. z-index: 2;
  461. }
  462. .tits view {
  463. font-size: 14px;
  464. color: #333;
  465. font-weight: bold;
  466. }
  467. .pad20 {
  468. padding: 20px;
  469. }
  470. .refundFalseRes {
  471. text-align: right;
  472. }
  473. .van-button:not(:last-child) {
  474. margin-right: 5px;
  475. }
  476. .code {
  477. width: 16px;
  478. margin: 0 0 0 5px;
  479. }
  480. .tips {
  481. position: fixed;
  482. background: rgba(0, 0, 0, 0.6);
  483. left: 0;
  484. right: 0;
  485. height: 40px;
  486. line-height: 40px;
  487. font-size: 12px;
  488. color: #fff;
  489. text-align: center;
  490. z-index: 50;
  491. justify-content: center;
  492. }
  493. .wxtips {
  494. flex: 0.8;
  495. overflow: hidden;
  496. text-overflow: ellipsis;
  497. white-space: nowrap;
  498. }
  499. .towx {
  500. flex: 0.2;
  501. }
  502. .van-search {
  503. background-color: rgba(255, 255, 255, 0) !important;
  504. }
  505. </style>
  506. <style>
  507. .loginout {
  508. background: #fff;
  509. width: 140rpx;
  510. font-size: 24rpx;
  511. height: 60rpx;
  512. line-height: 60rpx;
  513. border-radius: 30rpx;
  514. text-align: center;
  515. color: #1678ff;
  516. }
  517. .dots {
  518. display: block;
  519. height: 15px;
  520. border-radius: 15px;
  521. padding: 0 4px;
  522. font-size: 12px;
  523. color: #fff;
  524. line-height: 15px;
  525. background: #f51a1a;
  526. min-width: 15px;
  527. box-sizing: border-box;
  528. text-align: center;
  529. position: absolute;
  530. top: 12px;
  531. right: 36%;
  532. }
  533. .van-popover__action {
  534. width: 100% !important;
  535. height: 100% !important;
  536. padding: 10px 16px !important;
  537. }
  538. .list1 .li .start {
  539. color: #2f3440 !important;
  540. }
  541. .red {
  542. color: #f51a1a;
  543. }
  544. .van-popover {
  545. z-index: 1 !important;
  546. }
  547. .van-tabbar {
  548. z-index: 2 !important;
  549. }
  550. .search input {
  551. font-size: 28rpx !important;
  552. color: #333;
  553. }
  554. </style>