storeOrder.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643
  1. <template>
  2. <view>
  3. <view class="top-fixed">
  4. <!-- tab切换 -->
  5. <view class="pub-tab-box">
  6. <view class="tab-inner">
  7. <view
  8. v-for="(item,index) in orderStatus"
  9. :key="index"
  10. :class="status ==item.value?'item active':'item'"
  11. @click="orderStatusChange(item)">
  12. <view class="text">
  13. {{ item.name }}
  14. <image v-show="status ==item.value" class="tab-bg" src="https://jnlzjk-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/tab_bg.png" mode=""></image>
  15. </view>
  16. </view>
  17. </view>
  18. </view>
  19. <view class="search-cont">
  20. <view class="inner">
  21. <image class="icon-search" src="https://jnlzjk-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/search.png" mode=""></image>
  22. <input type="text" value="" placeholder="输入订单号" confirm-type="搜索" @confirm="goSearch" placeholder-style="font-size:28rpx;color:#BBBBBB;font-family: PingFang SC;" />
  23. </view>
  24. </view>
  25. </view>
  26. <view class="top-seat"></view>
  27. <!-- 订单列表 -->
  28. <mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption" :up="upOption">
  29. <view class="order-list">
  30. <view v-for="(item,index) in dataList" :key="index" class="item" >
  31. <!-- 订单号,状态 -->
  32. <view class="ordersn-box" @click="showDetail(item)">
  33. <view class="num">订单号:{{item.orderCode}}</view>
  34. <view class="status-box">
  35. <!-- <view class="recom-box">推荐订单</view> -->
  36. <text class="text success">
  37. {{utils.getDictLabelName("storeOrderStatus",item.status)}}
  38. </text>
  39. </view>
  40. </view>
  41. <!-- 产品列表 -->
  42. <!-- 商城 -->
  43. <view class="drug-list" v-if="item.orderType==1">
  44. <view @click="showDetail(item)" v-if="item.isPackage!=1" v-for="(subItem,subIndex) in item.items" :key="subIndex" class="drug-item" >
  45. <view class="img-box">
  46. <image :src="JSON.parse(subItem.jsonInfo).image" mode="aspectFill"></image>
  47. </view>
  48. <view class="drug-info" >
  49. <view>
  50. <view class="name-box ellipsis2">
  51. <view v-if="subItem.isPrescribe==1" class="tag">处方药</view>{{JSON.parse(subItem.jsonInfo).productName}}
  52. </view>
  53. <view class="spec ellipsis2">{{JSON.parse(subItem.jsonInfo).sku}}</view>
  54. </view>
  55. <view class="num-box">
  56. <view class="price">
  57. <text class="unit">¥</text>
  58. <text class="num">{{JSON.parse(subItem.jsonInfo).price.toFixed(2)}}</text>
  59. </view>
  60. <view class="amount">x{{JSON.parse(subItem.jsonInfo).num}}</view>
  61. </view>
  62. </view>
  63. </view>
  64. <view v-if="item.isPackage==1&&item.packageJson!=null" class="drug-item" @click="showDetail(item)">
  65. <view class="img-box">
  66. <image :src="JSON.parse(item.packageJson).imgUrl" mode="aspectFill"></image>
  67. </view>
  68. <view class="drug-info" >
  69. <view>
  70. <view class="name-box ellipsis2">
  71. <view class="tag">套餐</view>{{JSON.parse(item.packageJson).title}}
  72. </view>
  73. <view class="spec ellipsis2">{{JSON.parse(item.packageJson).descs}}</view>
  74. </view>
  75. <!-- <view class="num-box">
  76. <view class="price">
  77. <text class="unit">¥</text>
  78. <text class="num">{{JSON.parse(item.packageJson).payMoney.toFixed(2)}}</text>
  79. </view>
  80. <view class="amount"></view>
  81. </view> -->
  82. </view>
  83. </view>
  84. <!-- 实付金额、按钮 -->
  85. <view class="bottom-box">
  86. <view class="amount-paid">
  87. <text class="label">订单金额:</text>
  88. <view class="price-box">
  89. <view class="unit">¥</view>
  90. <view class="num" >{{item.payPrice.toFixed(2)}}</view>
  91. </view>
  92. </view>
  93. <view class="btn-box">
  94. <view v-if="item.status == 0" class="btn cancel" @click="cancel(item)">取消订单</view>
  95. <view v-if="item.status == 0" class="btn pay" @click="pay(item)">支付</view>
  96. <view v-if="item.isAfterSales==1" class="btn cancel" @click="refund(item)">申请售后</view>
  97. <view v-if="item.status >=2 &&item.deliveryId!=null" class="btn pay" @click.stop="showDelivery(item)">查看物流</view>
  98. <!-- <view v-if="item.status==4" class="btn pay">再次购买</view> -->
  99. </view>
  100. </view>
  101. </view>
  102. <!-- 直播 -->
  103. <view class="drug-list" v-if="item.orderType==2">
  104. <view @click="showDetail(item)" v-if="item.isPackage!=1" class="drug-item" >
  105. <view class="img-box">
  106. <image :src="JSON.parse(item.itemJson).image" mode="aspectFill"></image>
  107. </view>
  108. <view class="drug-info" >
  109. <view>
  110. <view class="name-box ellipsis2">
  111. <view v-if="item.isPrescribe==1" class="tag">处方药</view>{{JSON.parse(item.itemJson).productName}}
  112. </view>
  113. <view class="spec ellipsis2">{{JSON.parse(item.itemJson).sku}}</view>
  114. </view>
  115. <view class="num-box">
  116. <view class="price">
  117. <text class="unit">¥</text>
  118. <text class="num">{{JSON.parse(item.itemJson).price.toFixed(2)}}</text>
  119. </view>
  120. <view class="amount">x{{item.totalNum}}</view>
  121. </view>
  122. </view>
  123. </view>
  124. <view v-if="item.isPackage==1&&item.packageJson!=null" class="drug-item" @click="showDetail(item)">
  125. <view class="img-box">
  126. <image :src="JSON.parse(item.packageJson).imgUrl" mode="aspectFill"></image>
  127. </view>
  128. <view class="drug-info" >
  129. <view>
  130. <view class="name-box ellipsis2">
  131. <view class="tag">套餐</view>{{JSON.parse(item.packageJson).title}}
  132. </view>
  133. <view class="spec ellipsis2">{{JSON.parse(item.packageJson).descs}}</view>
  134. </view>
  135. <!-- <view class="num-box">
  136. <view class="price">
  137. <text class="unit">¥</text>
  138. <text class="num">{{JSON.parse(item.packageJson).payMoney.toFixed(2)}}</text>
  139. </view>
  140. <view class="amount"></view>
  141. </view> -->
  142. </view>
  143. </view>
  144. <!-- 实付金额、按钮 -->
  145. <view class="bottom-box">
  146. <view class="amount-paid">
  147. <text class="label">订单金额:</text>
  148. <view class="price-box">
  149. <view class="unit">¥</view>
  150. <view class="num" >{{item.payPrice.toFixed(2)}}</view>
  151. </view>
  152. </view>
  153. <view class="btn-box">
  154. <view v-if="item.status == 0" class="btn cancel" @click="cancel(item)">取消订单</view>
  155. <view v-if="item.status == 0" class="btn pay" @click="pay(item)">支付</view>
  156. <view v-if="item.isAfterSales==1" class="btn cancel" @click="refund(item)">申请售后</view>
  157. <view v-if="item.status >=2 &&item.deliveryId!=null" class="btn pay" @click.stop="showDelivery(item)">查看物流</view>
  158. <!-- <view v-if="item.status==4" class="btn pay">再次购买</view> -->
  159. </view>
  160. </view>
  161. </view>
  162. </view>
  163. </view>
  164. </mescroll-body>
  165. </view>
  166. </template>
  167. <script>
  168. import {getMyStoreOrderList,cancelOrder} from '@/api/storeOrder'
  169. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  170. export default {
  171. mixins: [MescrollMixin],
  172. data() {
  173. return {
  174. searchKey:"",
  175. status:0,
  176. orderStatus: [
  177. {name:"全部",value:""},
  178. {name:"待付款",value:"0"},
  179. {name:"待发货",value:"1"},
  180. {name:"待收货",value:"2"},
  181. {name:"已完成",value:"3"}
  182. ],
  183. mescroll:null,
  184. // 上拉加载的配置
  185. upOption: {
  186. onScroll:true,
  187. use: true, // 是否启用上拉加载; 默认true
  188. page: {
  189. num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
  190. size: 10 // 每页数据的数量,默认10
  191. },
  192. noMoreSize: 10, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
  193. empty: {
  194. icon:'https://jnlzjk-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/no_data.png',
  195. tip: '暂无数据'
  196. }
  197. },
  198. // 列表数据
  199. dataList: [],
  200. };
  201. },
  202. onLoad(option) {
  203. this.status = option.status
  204. var that=this;
  205. uni.$on('refreshOrder', () => {
  206. that.mescroll.resetUpScroll()
  207. });
  208. },
  209. methods: {
  210. goSearch(e) {
  211. this.searchKey=e.detail.value;
  212. this.mescroll.resetUpScroll()
  213. },
  214. refund(item) {
  215. if(item.orderType==2){
  216. uni.navigateTo({
  217. url: '/pages_shopping/live/refundOrderProduct?orderId=' + item.orderId
  218. })
  219. }else{
  220. uni.navigateTo({
  221. url: './refundOrderProduct?orderId='+item.id
  222. })
  223. }
  224. },
  225. // tab切换
  226. orderStatusChange(item) {
  227. this.status = item.value
  228. this.mescroll.resetUpScroll()
  229. },
  230. mescrollInit(mescroll) {
  231. this.mescroll = mescroll;
  232. },
  233. /*下拉刷新的回调 */
  234. downCallback(mescroll) {
  235. mescroll.resetUpScroll()
  236. },
  237. upCallback(page) {
  238. //联网加载数据
  239. var that = this;
  240. var data = {
  241. keyword:this.searchKey,
  242. status:this.status,
  243. page: page.num,
  244. pageSize: page.size
  245. };
  246. getMyStoreOrderList(data).then(res => {
  247. if(res.code==200){
  248. //设置列表数据
  249. if (page.num == 1) {
  250. that.dataList = res.data.list;
  251. } else {
  252. that.dataList = that.dataList.concat(res.data.list);
  253. }
  254. that.mescroll.endBySize(res.data.list.length, res.data.total);
  255. }else{
  256. uni.showToast({
  257. icon:'none',
  258. title: "请求失败",
  259. });
  260. that.dataList = null;
  261. that.mescroll.endErr();
  262. }
  263. });
  264. },
  265. // 查看订单详情
  266. showDetail(item) {
  267. console.log(item)
  268. if(item.orderType==2){
  269. uni.navigateTo({
  270. url: '/pages_shopping/live/storeOrderDetail?orderId=' + item.orderId
  271. })
  272. }else{
  273. uni.navigateTo({
  274. url: './storeOrderDetail?id=' + item.id
  275. })
  276. }
  277. },
  278. cancel(item){
  279. var that=this;
  280. uni.showModal({
  281. title: '提示',
  282. content: '确定取消订单吗',
  283. success: function (res) {
  284. if (res.confirm) {
  285. var data = {
  286. orderId:item.orderType==2?item.orderId:item.id
  287. };
  288. cancelOrder(data).then(res => {
  289. if(res.code==200){
  290. uni.showToast({
  291. icon:'success',
  292. title: "操作成功",
  293. });
  294. that.mescroll.resetUpScroll()
  295. }else{
  296. uni.showToast({
  297. icon:'none',
  298. title: res.msg,
  299. });
  300. }
  301. });
  302. }
  303. else if (res.cancel) {
  304. }
  305. }
  306. });
  307. },
  308. pay(item) {
  309. if(item.isPrescribe==1 && item.prescribeId==null){
  310. uni.navigateTo({
  311. url:"/pages/shopping/prescribe?orderId="+item.id
  312. });
  313. }
  314. else{
  315. if(item.orderType==2){
  316. // 支付
  317. console.log("去支付", item)
  318. uni.navigateTo({
  319. url: `/pages_shopping/live/paymentOrder?orderList=${encodeURIComponent(JSON.stringify(item))}`
  320. })
  321. }else{
  322. uni.navigateTo({
  323. url: '/pages/shopping/paymentOrder?orderId='+item.id
  324. })
  325. }
  326. }
  327. },
  328. // 查看物流
  329. showDelivery(item) {
  330. if(item.orderType==2){
  331. uni.navigateTo({
  332. url: `/pages_shopping/live/storeOrderDelivery?orderId=${item.orderId}`
  333. })
  334. }else{
  335. uni.navigateTo({
  336. url: './storeOrderDelivery?orderId='+item.id
  337. })
  338. }
  339. }
  340. }
  341. }
  342. </script>
  343. <style lang="scss">
  344. .top-fixed{
  345. width: 100%;
  346. position: fixed;
  347. top: 0;
  348. left: 0;
  349. z-index: 10;
  350. }
  351. .pub-tab-box{
  352. box-sizing: border-box;
  353. width: 100%;
  354. padding: 0 40upx;
  355. background-color: #FFFFFF;
  356. .tab-inner{
  357. height: 88upx;
  358. line-height: 88upx;
  359. display: flex;
  360. align-items: center;
  361. justify-content: space-between;
  362. overflow-x: auto;
  363. }
  364. .item{
  365. font-size: 28upx;
  366. white-space: nowrap;
  367. line-height: 1;
  368. font-family: PingFang SC;
  369. font-weight: 500;
  370. color: #666666;
  371. margin-right: 60upx;
  372. display: flex;
  373. align-items: center;
  374. justify-content: center;
  375. &:last-child{
  376. margin-right: 0;
  377. }
  378. &.active{
  379. font-weight: bold;
  380. color: #333333;
  381. }
  382. .text{
  383. position: relative;
  384. z-index: 1;
  385. }
  386. .tab-bg{
  387. width: 72upx;
  388. height: 28upx;
  389. position: absolute;
  390. top: 17upx;
  391. left: 50%;
  392. transform: translateX(-36upx);
  393. z-index: -1;
  394. }
  395. }
  396. }
  397. .top-seat{
  398. width: 100%;
  399. height: 192upx;
  400. }
  401. .search-cont{
  402. padding: 16upx 30upx;
  403. background-color: #FFFFFF;
  404. .inner{
  405. box-sizing: border-box;
  406. width: 100%;
  407. height: 72upx;
  408. background: #F7F7F7;
  409. border-radius: 36upx;
  410. display: flex;
  411. align-items: center;
  412. padding: 0 30upx;
  413. .icon-search{
  414. width: 28upx;
  415. height: 28upx;
  416. margin-right: 20upx;
  417. }
  418. input{
  419. height: 60upx;
  420. line-height: 60upx;
  421. flex: 1;
  422. }
  423. }
  424. }
  425. .order-list{
  426. padding: 20upx;
  427. .item{
  428. background: #FFFFFF;
  429. border-radius: 16upx;
  430. padding: 0 30upx;
  431. margin-bottom: 20upx;
  432. .ordersn-box{
  433. display: flex;
  434. align-items: center;
  435. justify-content: space-between;
  436. padding: 34upx 0 20upx;
  437. .num{
  438. font-size: 26upx;
  439. font-family: PingFang SC;
  440. font-weight: 500;
  441. color: #999999;
  442. line-height: 1;
  443. }
  444. .status-box{
  445. display: flex;
  446. align-items: center;
  447. .recom-box{
  448. width: 108upx;
  449. height: 30upx;
  450. line-height: 30upx;
  451. text-align: left;
  452. padding-left: 8upx;
  453. font-size: 22upx;
  454. font-family: PingFang SC;
  455. font-weight: 500;
  456. color: #FFFFFF;
  457. background-image: url(https://jnlzjk-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/recom.png);
  458. background-repeat: no-repeat;
  459. background-size: 100% 100%;
  460. margin-right: 8upx;
  461. }
  462. .text{
  463. font-size: 28upx;
  464. font-family: PingFang SC;
  465. font-weight: 500;
  466. line-height: 1;
  467. &.success{
  468. color: #2BC7B9;
  469. }
  470. &.black{
  471. color: #111111;
  472. }
  473. &.info{
  474. color: #999999;
  475. }
  476. }
  477. }
  478. }
  479. .drug-list{
  480. .drug-item{
  481. padding: 30upx 0;
  482. border-bottom: 1px soli #F0F0F0;
  483. display: flex;
  484. align-items: center;
  485. .img-box{
  486. width: 160upx;
  487. height: 160upx;
  488. margin-right: 30upx;
  489. flex-shrink: 0;
  490. image{
  491. width: 100%;
  492. height: 100%;
  493. }
  494. }
  495. .drug-info{
  496. width: calc(100% - 190upx);
  497. height: 160upx;
  498. display: flex;
  499. flex-direction: column;
  500. justify-content: space-between;
  501. .name-box{
  502. font-size: 28upx;
  503. font-family: PingFang SC;
  504. font-weight: 500;
  505. color: #111111;
  506. line-height: 40upx;
  507. .tag{
  508. display: inline-block;
  509. padding: 0 6upx;
  510. height: 30upx;
  511. background: linear-gradient(90deg, #66b2ef 0%, #2BC7B9 100%);
  512. border-radius: 4upx;
  513. margin-right: 10upx;
  514. font-size: 22upx;
  515. font-family: PingFang SC;
  516. font-weight: bold;
  517. color: #FFFFFF;
  518. line-height: 30upx;
  519. float: left;
  520. margin-top: 7upx;
  521. }
  522. }
  523. .spec{
  524. font-size: 24upx;
  525. font-family: PingFang SC;
  526. font-weight: 500;
  527. color: #999999;
  528. line-height: 1;
  529. margin-top: 10upx;
  530. }
  531. .num-box{
  532. display: flex;
  533. align-items: center;
  534. justify-content: space-between;
  535. .price{
  536. display: flex;
  537. align-items: flex-end;
  538. .unit{
  539. font-size: 24upx;
  540. font-family: PingFang SC;
  541. font-weight: 500;
  542. color: #111111;
  543. line-height: 1.2;
  544. margin-right: 4upx;
  545. }
  546. .num{
  547. font-size: 32upx;
  548. font-family: PingFang SC;
  549. font-weight: 500;
  550. color: #111111;
  551. line-height: 1;
  552. }
  553. }
  554. .amount{
  555. font-size: 24upx;
  556. font-family: PingFang SC;
  557. font-weight: 500;
  558. color: #999999;
  559. line-height: 1;
  560. }
  561. }
  562. }
  563. }
  564. .bottom-box{
  565. height: 110upx;
  566. display: flex;
  567. align-items: center;
  568. justify-content: space-between;
  569. .amount-paid{
  570. display: flex;
  571. align-items: center;
  572. .label{
  573. font-size: 24upx;
  574. font-family: PingFang SC;
  575. font-weight: 500;
  576. color: #999999;
  577. line-height: 1;
  578. }
  579. .price-box{
  580. display: flex;
  581. align-items: flex-end;
  582. .unit{
  583. font-size: 24upx;
  584. font-family: PingFang SC;
  585. font-weight: 500;
  586. color: #FF6633;
  587. line-height: 1.2;
  588. margin-right: 4upx;
  589. }
  590. .num{
  591. font-size: 32upx;
  592. font-family: PingFang SC;
  593. font-weight: bold;
  594. color: #FF6633;
  595. line-height: 1;
  596. }
  597. }
  598. }
  599. .btn-box{
  600. box-sizing: border-box;
  601. display: flex;
  602. align-items: center;
  603. .btn{
  604. width: 155upx;
  605. height: 64upx;
  606. line-height: 64upx;
  607. font-size: 26upx;
  608. font-family: PingFang SC;
  609. font-weight: 500;
  610. text-align: center;
  611. border-radius: 32upx;
  612. margin-left: 15upx;
  613. &:first-child{
  614. margin-left: 0;
  615. }
  616. &.cancel{
  617. border: 1px solid #DDDDDD;
  618. color: #666666;
  619. }
  620. &.pay{
  621. background: #2BC7B9;
  622. color: #FFFFFF;
  623. }
  624. }
  625. }
  626. }
  627. }
  628. }
  629. }
  630. </style>