storeOrderList.vue 13 KB

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