storeOrderList.vue 13 KB

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