storeOrder.vue 18 KB

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