storeOrderList.vue 12 KB

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