index.vue 13 KB

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