storeOrderList.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516
  1. <template>
  2. <view>
  3. <u-sticky>
  4. <view class="top-fixed">
  5. <u-tabs
  6. :scrollable="false"
  7. :list="tabs"
  8. lineColor="#2583EB"
  9. :current="status"
  10. @change="tabChange">
  11. </u-tabs>
  12. </view>
  13. </u-sticky>
  14. <!-- 订单列表 -->
  15. <mescroll-body top="88rpx" bottom="0" ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption" :up="upOption">
  16. <view class="order-list">
  17. <view v-for="(item,index) in dataList" :key="index" class="item" >
  18. <!-- 订单号,状态 -->
  19. <view class="ordersn-box" @click="showDetail(item)">
  20. <view class="num">订单号:{{item.orderCode}}</view>
  21. <view class="status-box">
  22. <text class="text info" v-if="item.status==1">
  23. {{$getDictLabelName(orderStatusOptions,item.status)}}
  24. </text>
  25. <text class="text success" v-if="item.status>1">
  26. {{$getDictLabelName(orderStatusOptions,item.status)}}
  27. </text>
  28. <text class="text info" v-if="item.status<0">
  29. {{$getDictLabelName(orderStatusOptions,item.status)}}
  30. </text>
  31. </view>
  32. </view>
  33. <!-- 药品列表 -->
  34. <view class="drug-list" >
  35. <view @click="showDetail(item)" v-for="(subItem,subIndex) in item.items" :key="subIndex" class="drug-item" >
  36. <view class="img-box">
  37. <image :src="JSON.parse(subItem.jsonInfo).image==''?'/static/images/drug.svg':JSON.parse(subItem.jsonInfo).image" mode="aspectFill"></image>
  38. </view>
  39. <view class="drug-info" >
  40. <view>
  41. <view class="name-box ellipsis2">
  42. {{JSON.parse(subItem.jsonInfo).productName}}
  43. </view>
  44. <view class="spec ellipsis2">{{JSON.parse(subItem.jsonInfo).sku}}</view>
  45. </view>
  46. <view class="num-box">
  47. <view class="price">
  48. <!-- <text class="unit">¥</text> -->
  49. <!-- <text class="num" v-if="JSON.parse(subItem.jsonInfo).price!=null">{{JSON.parse(subItem.jsonInfo).price.toFixed(2)}}</text> -->
  50. </view>
  51. <view class="amount" v-if="item.ordetType==1">x{{JSON.parse(subItem.jsonInfo).num}}</view>
  52. </view>
  53. </view>
  54. </view>
  55. <!-- 实付金额、按钮 -->
  56. <view class="bottom-box">
  57. <view class="amount-paid">
  58. <text class="label">订单金额:</text>
  59. <view class="price-box">
  60. <view class="unit">¥</view>
  61. <view class="num" >{{item.payPrice.toFixed(2)}}</view>
  62. </view>
  63. </view>
  64. <view class="btn-box">
  65. <!-- <view class="btn cancel">
  66. 联系客服
  67. <button class='contact-btn' open-type="contact">
  68. </button>
  69. </view> -->
  70. <view v-if="item.status == 1" class="btn cancel" @click="cancel(item)">取消订单</view>
  71. <view v-if="item.status == 1" class="btn pay" @click="pay(item)">支付</view>
  72. <view v-if="item.isAfterSales==1" class="btn cancel" @click="refund(item)">申请售后</view>
  73. <view v-if="showInvoice(item)&&item.status==4&&item.billPrice != item.payPrice" class="btn cancel" @click="handleInvoice(item)">申请开票</view>
  74. <view v-if="item.status==4&&item.billPrice" class="btn pay" @click="handleInvoiceList(item)">查看发票</view>
  75. <!-- <view v-if="item.deliverySn!=null" class="btn pay" @click.stop="showDelivery(item)">查看物流</view> -->
  76. <view class="btn pay" v-if="item.status==3" @click="finish(item)">确认收货</view>
  77. </view>
  78. </view>
  79. </view>
  80. </view>
  81. </view>
  82. </mescroll-body>
  83. </view>
  84. </template>
  85. <script>
  86. import {getDictByKey} from '@/api/common.js'
  87. import {getMyStoreOrderList,cancelOrder,finishOrder} from '@/api/storeOrder'
  88. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  89. export default {
  90. mixins: [MescrollMixin],
  91. data() {
  92. return {
  93. orderStatusOptions:[],
  94. searchKey:"",
  95. status:0,
  96. tabs: [
  97. {name:"全部",id:"0"},
  98. {name:"待付款",id:"1"},
  99. {name:"待发货",id:"2"},
  100. {name:"待收货",id:"3"},
  101. {name:"已完成",id:"4"}
  102. ],
  103. mescroll:null,
  104. // 上拉加载的配置
  105. upOption: {
  106. onScroll:false,
  107. use: true, // 是否启用上拉加载; 默认true
  108. page: {
  109. pae: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
  110. size: 10 // 每页数据的数量,默认10
  111. },
  112. noMoreSize: 10, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
  113. textNoMore:"已经到底了",
  114. empty: {
  115. icon:'https://zkzh-2025.oss-cn-beijing.aliyuncs.com/appimgs/cf4a86b913a04341bb44e34bb4d37aa2.png',
  116. tip: '暂无数据'
  117. }
  118. },
  119. // 列表数据
  120. dataList: []
  121. };
  122. },
  123. onLoad(option) {
  124. var that=this;
  125. this.status = option.status || 0
  126. uni.$on('refreshStoreOrder', () => {
  127. that.mescroll.resetUpScroll()
  128. })
  129. this.getDictByKey("sys_order_status");
  130. },
  131. methods: {
  132. getDictByKey(key){
  133. var data={key:key}
  134. getDictByKey(data).then(
  135. res => {
  136. if(res.code==200){
  137. if(key=="sys_order_status"){
  138. this.orderStatusOptions=res.data;
  139. }
  140. }
  141. },
  142. err => {
  143. }
  144. );
  145. },
  146. goSearch(e) {
  147. this.searchKey=e.detail.value;
  148. this.mescroll.resetUpScroll()
  149. },
  150. refund(item) {
  151. uni.navigateTo({
  152. url: '/pages/store/storeOrderRefundApply?orderId='+item.orderId
  153. })
  154. },
  155. tabChange(item) {
  156. this.status = item.id
  157. this.mescroll.resetUpScroll()
  158. },
  159. mescrollInit(mescroll) {
  160. this.mescroll = mescroll;
  161. },
  162. /*下拉刷新的回调 */
  163. downCallback(mescroll) {
  164. mescroll.resetUpScroll()
  165. },
  166. upCallback(page) {
  167. //联网加载数据
  168. var that = this;
  169. var data = {
  170. keyword:this.searchKey,
  171. status:this.status,
  172. pageNum: page.num,
  173. pageSize: page.size
  174. };
  175. getMyStoreOrderList(data).then(res => {
  176. if(res.code==200){
  177. //设置列表数据
  178. res.data.list.forEach(function(value, index, array){
  179. value.items=JSON.parse(value.itemJson)
  180. })
  181. if (page.num == 1) {
  182. that.dataList = res.data.list;
  183. } else {
  184. that.dataList = that.dataList.concat(res.data.list);
  185. }
  186. that.mescroll.endBySize(res.data.list.length, res.data.total);
  187. }else{
  188. uni.showToast({
  189. icon:'none',
  190. title: "请求失败",
  191. });
  192. that.dataList = null;
  193. that.mescroll.endErr();
  194. }
  195. });
  196. },
  197. // 查看订单详情
  198. showDetail(item) {
  199. uni.navigateTo({
  200. url: './storeOrderDetail?orderId=' + item.orderId
  201. })
  202. },
  203. finish(item){
  204. var that=this;
  205. uni.showModal({
  206. title: '提示',
  207. content: '确定已收货吗',
  208. success: function (res) {
  209. if (res.confirm) {
  210. var data = {
  211. orderId:item.orderId
  212. };
  213. finishOrder(data).then(res => {
  214. if(res.code==200){
  215. uni.showToast({
  216. icon:'success',
  217. title: "操作成功",
  218. });
  219. that.mescroll.resetUpScroll()
  220. }else{
  221. uni.showToast({
  222. icon:'none',
  223. title: res.msg,
  224. });
  225. }
  226. });
  227. }
  228. else if (res.cancel) {
  229. }
  230. }
  231. });
  232. },
  233. cancel(item){
  234. var that=this;
  235. uni.showModal({
  236. title: '提示',
  237. content: '确定取消订单吗',
  238. success: function (res) {
  239. if (res.confirm) {
  240. var data = {
  241. orderId:item.orderId
  242. };
  243. cancelOrder(data).then(res => {
  244. if(res.code==200){
  245. uni.showToast({
  246. icon:'success',
  247. title: "操作成功",
  248. });
  249. that.mescroll.resetUpScroll()
  250. }else{
  251. uni.showToast({
  252. icon:'none',
  253. title: res.msg,
  254. });
  255. }
  256. });
  257. }
  258. else if (res.cancel) {
  259. }
  260. }
  261. });
  262. },
  263. pay(item) {
  264. uni.navigateTo({
  265. url: '/pages/store/storeOrderPay?orderId='+item.orderId
  266. })
  267. },
  268. // 查看物流
  269. showDelivery(item) {
  270. uni.navigateTo({
  271. url: './storeOrderDelivery?orderId='+item.orderId
  272. })
  273. },
  274. showInvoice(item) {
  275. const time = item.createTime
  276. const targetDate = new Date('2025-01-01 00:00:00');
  277. const currentDate = new Date(time);
  278. if (time && currentDate >= targetDate) {
  279. return true
  280. } else {
  281. return false
  282. }
  283. },
  284. // 申请开票
  285. handleInvoice(item) {
  286. uni.navigateTo({
  287. url: './invoice/index?orderId='+item.orderId
  288. })
  289. },
  290. // 开票历史
  291. handleInvoiceList(item) {
  292. uni.navigateTo({
  293. url: './invoice/invoiceList?orderId='+item.orderId
  294. })
  295. },
  296. }
  297. }
  298. </script>
  299. <style lang="scss">
  300. .top-fixed{
  301. width: 100%;
  302. position: absolute;
  303. top: 0;
  304. left: 0;
  305. z-index: 10;
  306. height: 88upx;
  307. background-color: #fff;
  308. }
  309. .order-list{
  310. padding: 20upx;
  311. .item{
  312. background: #FFFFFF;
  313. border-radius: 16upx;
  314. padding: 0 30upx;
  315. margin-bottom: 20upx;
  316. .ordersn-box{
  317. display: flex;
  318. align-items: center;
  319. justify-content: space-between;
  320. padding: 34upx 0 20upx;
  321. .num{
  322. font-size: 26upx;
  323. font-family: PingFang SC;
  324. font-weight: 500;
  325. color: #999999;
  326. line-height: 1;
  327. }
  328. .status-box{
  329. display: flex;
  330. align-items: center;
  331. .text{
  332. font-size: 28upx;
  333. font-family: PingFang SC;
  334. font-weight: 500;
  335. line-height: 1;
  336. &.success{
  337. color: #2583EB;
  338. }
  339. &.black{
  340. color: #111111;
  341. }
  342. &.info{
  343. color: #999999;
  344. }
  345. }
  346. }
  347. }
  348. .drug-list{
  349. .drug-item{
  350. padding: 30upx 0;
  351. border-bottom: 1px soli #F0F0F0;
  352. display: flex;
  353. align-items: center;
  354. .img-box{
  355. width: 160upx;
  356. height: 160upx;
  357. margin-right: 30upx;
  358. flex-shrink: 0;
  359. image{
  360. width: 100%;
  361. height: 100%;
  362. }
  363. }
  364. .drug-info{
  365. width: calc(100% - 190upx);
  366. height: 160upx;
  367. display: flex;
  368. flex-direction: column;
  369. justify-content: space-between;
  370. .name-box{
  371. font-size: 28upx;
  372. font-family: PingFang SC;
  373. font-weight: 500;
  374. color: #111111;
  375. line-height: 40upx;
  376. .tag{
  377. display: inline-block;
  378. padding: 0 6upx;
  379. height: 30upx;
  380. background: linear-gradient(90deg, #2583EB 0%, #E0F5FF 100%);
  381. border-radius: 4upx;
  382. margin-right: 10upx;
  383. font-size: 22upx;
  384. font-family: PingFang SC;
  385. font-weight: bold;
  386. color: #FFFFFF;
  387. line-height: 30upx;
  388. float: left;
  389. margin-top: 7upx;
  390. }
  391. }
  392. .spec{
  393. font-size: 24upx;
  394. font-family: PingFang SC;
  395. font-weight: 500;
  396. color: #999999;
  397. line-height: 1;
  398. margin-top: 10upx;
  399. }
  400. .num-box{
  401. display: flex;
  402. align-items: center;
  403. justify-content: space-between;
  404. .price{
  405. display: flex;
  406. align-items: flex-end;
  407. .unit{
  408. font-size: 24upx;
  409. font-family: PingFang SC;
  410. font-weight: 500;
  411. color: #111111;
  412. line-height: 1.2;
  413. margin-right: 4upx;
  414. }
  415. .num{
  416. font-size: 32upx;
  417. font-family: PingFang SC;
  418. font-weight: 500;
  419. color: #111111;
  420. line-height: 1;
  421. }
  422. }
  423. .amount{
  424. font-size: 24upx;
  425. font-family: PingFang SC;
  426. font-weight: 500;
  427. color: #999999;
  428. line-height: 1;
  429. }
  430. }
  431. }
  432. }
  433. .bottom-box{
  434. height: 110upx;
  435. display: flex;
  436. align-items: center;
  437. justify-content: space-between;
  438. .amount-paid{
  439. display: flex;
  440. align-items: center;
  441. .label{
  442. font-size: 24upx;
  443. font-family: PingFang SC;
  444. font-weight: 500;
  445. color: #999999;
  446. line-height: 1;
  447. }
  448. .price-box{
  449. display: flex;
  450. align-items: flex-end;
  451. .unit{
  452. font-size: 24upx;
  453. font-family: PingFang SC;
  454. font-weight: 500;
  455. color: #FF6633;
  456. line-height: 1.2;
  457. margin-right: 4upx;
  458. }
  459. .num{
  460. font-size: 32upx;
  461. font-family: PingFang SC;
  462. font-weight: bold;
  463. color: #FF6633;
  464. line-height: 1;
  465. }
  466. }
  467. }
  468. .btn-box{
  469. box-sizing: border-box;
  470. display: flex;
  471. align-items: center;
  472. .btn{
  473. position: relative;
  474. width: 155upx;
  475. height: 64upx;
  476. line-height: 64upx;
  477. font-size: 26upx;
  478. font-family: PingFang SC;
  479. font-weight: 500;
  480. text-align: center;
  481. border-radius: 32upx;
  482. margin-left: 15upx;
  483. &:first-child{
  484. margin-left: 0;
  485. }
  486. &.cancel{
  487. border: 1px solid #DDDDDD;
  488. color: #666666;
  489. }
  490. &.pay{
  491. background: #2583EB;
  492. color: #FFFFFF;
  493. }
  494. .contact-btn {
  495. top: 0;
  496. position: absolute;
  497. width:100%;
  498. height:100%;
  499. opacity: 0;
  500. }
  501. }
  502. }
  503. }
  504. }
  505. }
  506. }
  507. </style>