storeOrderList.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512
  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. // 上拉加载的配置
  102. upOption: {
  103. onScroll:false,
  104. use: true, // 是否启用上拉加载; 默认true
  105. page: {
  106. pae: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
  107. size: 10 // 每页数据的数量,默认10
  108. },
  109. noMoreSize: 10, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
  110. textNoMore:"已经到底了",
  111. empty: {
  112. icon:'https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/app/newImages/empty_icon.png',
  113. tip: '暂无数据'
  114. }
  115. },
  116. // 列表数据
  117. dataList: []
  118. };
  119. },
  120. onLoad(option) {
  121. var that=this;
  122. uni.$on('refreshStoreOrder', () => {
  123. that.mescroll.resetUpScroll()
  124. })
  125. this.getDictByKey("sys_order_status");
  126. },
  127. methods: {
  128. getDictByKey(key){
  129. var data={key:key}
  130. getDictByKey(data).then(
  131. res => {
  132. if(res.code==200){
  133. if(key=="sys_order_status"){
  134. this.orderStatusOptions=res.data;
  135. }
  136. }
  137. },
  138. err => {
  139. }
  140. );
  141. },
  142. goSearch(e) {
  143. this.searchKey=e.detail.value;
  144. this.mescroll.resetUpScroll()
  145. },
  146. refund(item) {
  147. uni.navigateTo({
  148. url: '/pages_order/storeOrderRefundApply?orderId='+item.orderId
  149. })
  150. },
  151. tabChange(item) {
  152. this.status = item.id
  153. this.mescroll.resetUpScroll()
  154. },
  155. mescrollInit(mescroll) {
  156. this.mescroll = mescroll;
  157. },
  158. /*下拉刷新的回调 */
  159. downCallback(mescroll) {
  160. mescroll.resetUpScroll()
  161. },
  162. upCallback(page) {
  163. //联网加载数据
  164. var that = this;
  165. var data = {
  166. keyword:this.searchKey,
  167. status:this.status,
  168. pageNum: page.num,
  169. pageSize: page.size
  170. };
  171. getMyStoreOrderList(data).then(res => {
  172. if(res.code==200){
  173. //设置列表数据
  174. res.data.list.forEach(function(value, index, array){
  175. value.items=JSON.parse(value.itemJson)
  176. })
  177. if (page.num == 1) {
  178. that.dataList = res.data.list;
  179. } else {
  180. that.dataList = that.dataList.concat(res.data.list);
  181. }
  182. that.mescroll.endBySize(res.data.list.length, res.data.total);
  183. }else{
  184. uni.showToast({
  185. icon:'none',
  186. title: "请求失败",
  187. });
  188. that.dataList = null;
  189. that.mescroll.endErr();
  190. }
  191. });
  192. },
  193. // 查看订单详情
  194. showDetail(item) {
  195. uni.navigateTo({
  196. url: './storeOrderDetail?orderId=' + item.orderId
  197. })
  198. },
  199. finish(item){
  200. var that=this;
  201. uni.showModal({
  202. title: '提示',
  203. content: '确定已收货吗',
  204. success: function (res) {
  205. if (res.confirm) {
  206. var data = {
  207. orderId:item.orderId
  208. };
  209. finishOrder(data).then(res => {
  210. if(res.code==200){
  211. uni.showToast({
  212. icon:'success',
  213. title: "操作成功",
  214. });
  215. that.mescroll.resetUpScroll()
  216. }else{
  217. uni.showToast({
  218. icon:'none',
  219. title: res.msg,
  220. });
  221. }
  222. });
  223. }
  224. else if (res.cancel) {
  225. }
  226. }
  227. });
  228. },
  229. cancel(item){
  230. var that=this;
  231. uni.showModal({
  232. title: '提示',
  233. content: '确定取消订单吗',
  234. success: function (res) {
  235. if (res.confirm) {
  236. var data = {
  237. orderId:item.orderId
  238. };
  239. cancelOrder(data).then(res => {
  240. if(res.code==200){
  241. uni.showToast({
  242. icon:'success',
  243. title: "操作成功",
  244. });
  245. that.mescroll.resetUpScroll()
  246. }else{
  247. uni.showToast({
  248. icon:'none',
  249. title: res.msg,
  250. });
  251. }
  252. });
  253. }
  254. else if (res.cancel) {
  255. }
  256. }
  257. });
  258. },
  259. pay(item) {
  260. uni.navigateTo({
  261. url: '/pages_order/storeOrderPay?orderId='+item.orderId
  262. })
  263. },
  264. // 查看物流
  265. showDelivery(item) {
  266. uni.navigateTo({
  267. url: './storeOrderDelivery?orderId='+item.orderId
  268. })
  269. },
  270. showInvoice(item) {
  271. const time = item.createTime
  272. const targetDate = new Date('2025-01-01 00:00:00');
  273. const currentDate = new Date(time);
  274. if (time && currentDate >= targetDate) {
  275. return true
  276. } else {
  277. return false
  278. }
  279. },
  280. // 申请开票
  281. handleInvoice(item) {
  282. uni.navigateTo({
  283. url: './invoice/index?orderId='+item.orderId
  284. })
  285. },
  286. // 开票历史
  287. handleInvoiceList(item) {
  288. uni.navigateTo({
  289. url: './invoice/invoiceList?orderId='+item.orderId
  290. })
  291. },
  292. }
  293. }
  294. </script>
  295. <style lang="scss">
  296. .top-fixed{
  297. width: 100%;
  298. position: fixed;
  299. top: 0;
  300. left: 0;
  301. z-index: 10;
  302. height: 88upx;
  303. background-color: #fff;
  304. }
  305. .order-list{
  306. padding: 20upx;
  307. .item{
  308. background: #FFFFFF;
  309. border-radius: 16upx;
  310. padding: 0 30upx;
  311. margin-bottom: 20upx;
  312. .ordersn-box{
  313. display: flex;
  314. align-items: center;
  315. justify-content: space-between;
  316. padding: 34upx 0 20upx;
  317. .num{
  318. font-size: 26upx;
  319. font-family: PingFang SC;
  320. font-weight: 500;
  321. color: #999999;
  322. line-height: 1;
  323. }
  324. .status-box{
  325. display: flex;
  326. align-items: center;
  327. .text{
  328. font-size: 28upx;
  329. font-family: PingFang SC;
  330. font-weight: 500;
  331. line-height: 1;
  332. &.success{
  333. color: #2583EB;
  334. }
  335. &.black{
  336. color: #111111;
  337. }
  338. &.info{
  339. color: #999999;
  340. }
  341. }
  342. }
  343. }
  344. .drug-list{
  345. .drug-item{
  346. padding: 30upx 0;
  347. border-bottom: 1px soli #F0F0F0;
  348. display: flex;
  349. align-items: center;
  350. .img-box{
  351. width: 160upx;
  352. height: 160upx;
  353. margin-right: 30upx;
  354. flex-shrink: 0;
  355. image{
  356. width: 100%;
  357. height: 100%;
  358. }
  359. }
  360. .drug-info{
  361. width: calc(100% - 190upx);
  362. height: 160upx;
  363. display: flex;
  364. flex-direction: column;
  365. justify-content: space-between;
  366. .name-box{
  367. font-size: 28upx;
  368. font-family: PingFang SC;
  369. font-weight: 500;
  370. color: #111111;
  371. line-height: 40upx;
  372. .tag{
  373. display: inline-block;
  374. padding: 0 6upx;
  375. height: 30upx;
  376. background: linear-gradient(90deg, #2583EB 0%, #2EDAD4 100%);
  377. border-radius: 4upx;
  378. margin-right: 10upx;
  379. font-size: 22upx;
  380. font-family: PingFang SC;
  381. font-weight: bold;
  382. color: #FFFFFF;
  383. line-height: 30upx;
  384. float: left;
  385. margin-top: 7upx;
  386. }
  387. }
  388. .spec{
  389. font-size: 24upx;
  390. font-family: PingFang SC;
  391. font-weight: 500;
  392. color: #999999;
  393. line-height: 1;
  394. margin-top: 10upx;
  395. }
  396. .num-box{
  397. display: flex;
  398. align-items: center;
  399. justify-content: space-between;
  400. .price{
  401. display: flex;
  402. align-items: flex-end;
  403. .unit{
  404. font-size: 24upx;
  405. font-family: PingFang SC;
  406. font-weight: 500;
  407. color: #111111;
  408. line-height: 1.2;
  409. margin-right: 4upx;
  410. }
  411. .num{
  412. font-size: 32upx;
  413. font-family: PingFang SC;
  414. font-weight: 500;
  415. color: #111111;
  416. line-height: 1;
  417. }
  418. }
  419. .amount{
  420. font-size: 24upx;
  421. font-family: PingFang SC;
  422. font-weight: 500;
  423. color: #999999;
  424. line-height: 1;
  425. }
  426. }
  427. }
  428. }
  429. .bottom-box{
  430. height: 110upx;
  431. display: flex;
  432. align-items: center;
  433. justify-content: space-between;
  434. .amount-paid{
  435. display: flex;
  436. align-items: center;
  437. .label{
  438. font-size: 24upx;
  439. font-family: PingFang SC;
  440. font-weight: 500;
  441. color: #999999;
  442. line-height: 1;
  443. }
  444. .price-box{
  445. display: flex;
  446. align-items: flex-end;
  447. .unit{
  448. font-size: 24upx;
  449. font-family: PingFang SC;
  450. font-weight: 500;
  451. color: #FF6633;
  452. line-height: 1.2;
  453. margin-right: 4upx;
  454. }
  455. .num{
  456. font-size: 32upx;
  457. font-family: PingFang SC;
  458. font-weight: bold;
  459. color: #FF6633;
  460. line-height: 1;
  461. }
  462. }
  463. }
  464. .btn-box{
  465. box-sizing: border-box;
  466. display: flex;
  467. align-items: center;
  468. .btn{
  469. position: relative;
  470. width: 155upx;
  471. height: 64upx;
  472. line-height: 64upx;
  473. font-size: 26upx;
  474. font-family: PingFang SC;
  475. font-weight: 500;
  476. text-align: center;
  477. border-radius: 32upx;
  478. margin-left: 15upx;
  479. &:first-child{
  480. margin-left: 0;
  481. }
  482. &.cancel{
  483. border: 1px solid #DDDDDD;
  484. color: #666666;
  485. }
  486. &.pay{
  487. background: #2583EB;
  488. color: #FFFFFF;
  489. }
  490. .contact-btn {
  491. top: 0;
  492. position: absolute;
  493. width:100%;
  494. height:100%;
  495. opacity: 0;
  496. }
  497. }
  498. }
  499. }
  500. }
  501. }
  502. }
  503. </style>