storeOrder.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693
  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!==2">
  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,canceliveOrder, deleteOrder as deleteOrderApi, cancelLiveOrder} 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. if(item.orderType==2){
  291. cancelLiveOrder(data).then(res => {
  292. if(res.code==200){
  293. uni.showToast({
  294. icon:'success',
  295. title: "操作成功",
  296. });
  297. that.mescroll.resetUpScroll()
  298. }else{
  299. uni.showToast({
  300. icon:'none',
  301. title: res.msg,
  302. });
  303. }
  304. });
  305. }else{
  306. cancelOrder(data).then(res => {
  307. if(res.code==200){
  308. uni.showToast({
  309. icon:'success',
  310. title: "操作成功",
  311. });
  312. that.mescroll.resetUpScroll()
  313. }else{
  314. uni.showToast({
  315. icon:'none',
  316. title: res.msg,
  317. });
  318. }
  319. });
  320. }
  321. }
  322. else if (res.cancel) {
  323. }
  324. }
  325. });
  326. },
  327. pay(item) {
  328. if(item.isPrescribe==1 && item.prescribeId==null){
  329. uni.navigateTo({
  330. url:"/pages/shopping/prescribe?orderId="+item.id
  331. });
  332. }
  333. else{
  334. if(item.orderType==2){
  335. // 支付
  336. console.log("去支付", item)
  337. uni.navigateTo({
  338. url: `/pages_shopping/live/paymentOrder?orderList=${encodeURIComponent(JSON.stringify(item))}`
  339. })
  340. }else{
  341. uni.navigateTo({
  342. url: '/pages/shopping/paymentOrder?orderId='+item.id
  343. })
  344. }
  345. }
  346. },
  347. // 查看物流
  348. showDelivery(item) {
  349. if(item.orderType==2){
  350. uni.navigateTo({
  351. url: `/pages_shopping/live/storeOrderDelivery?orderId=${item.orderId}`
  352. })
  353. }else{
  354. uni.navigateTo({
  355. url: './storeOrderDelivery?orderId='+item.id
  356. })
  357. }
  358. },
  359. // 删除订单
  360. deleteOrder(item) {
  361. var that = this;
  362. uni.showModal({
  363. title: '提示',
  364. content: '确定删除订单吗?删除后无法恢复',
  365. success: function (res) {
  366. if (res.confirm) {
  367. var data = {
  368. orderId: item.orderType == 2 ? item.orderId : item.id,
  369. orderType: item.orderType
  370. };
  371. deleteOrderApi(data).then(res => {
  372. if(res.code == 200){
  373. uni.showToast({
  374. icon:'success',
  375. title: "删除成功",
  376. });
  377. that.mescroll.resetUpScroll()
  378. }else{
  379. uni.showToast({
  380. icon:'none',
  381. title: res.msg,
  382. });
  383. }
  384. });
  385. }
  386. }
  387. });
  388. }
  389. }
  390. }
  391. </script>
  392. <style lang="scss">
  393. .top-fixed{
  394. width: 100%;
  395. position: fixed;
  396. top: 0;
  397. left: 0;
  398. z-index: 10;
  399. }
  400. .pub-tab-box{
  401. box-sizing: border-box;
  402. width: 100%;
  403. padding: 0 40upx;
  404. background-color: #FFFFFF;
  405. .tab-inner{
  406. height: 88upx;
  407. line-height: 88upx;
  408. display: flex;
  409. align-items: center;
  410. justify-content: space-between;
  411. overflow-x: auto;
  412. }
  413. .item{
  414. font-size: 28upx;
  415. white-space: nowrap;
  416. line-height: 1;
  417. font-family: PingFang SC;
  418. font-weight: 500;
  419. color: #666666;
  420. margin-right: 60upx;
  421. display: flex;
  422. align-items: center;
  423. justify-content: center;
  424. &:last-child{
  425. margin-right: 0;
  426. }
  427. &.active{
  428. font-weight: bold;
  429. color: #333333;
  430. }
  431. .text{
  432. position: relative;
  433. z-index: 1;
  434. }
  435. .tab-bg{
  436. width: 72upx;
  437. height: 28upx;
  438. position: absolute;
  439. top: 17upx;
  440. left: 50%;
  441. transform: translateX(-36upx);
  442. z-index: -1;
  443. }
  444. }
  445. }
  446. .top-seat{
  447. width: 100%;
  448. height: 192upx;
  449. }
  450. .search-cont{
  451. padding: 16upx 30upx;
  452. background-color: #FFFFFF;
  453. .inner{
  454. box-sizing: border-box;
  455. width: 100%;
  456. height: 72upx;
  457. background: #F7F7F7;
  458. border-radius: 36upx;
  459. display: flex;
  460. align-items: center;
  461. padding: 0 30upx;
  462. .icon-search{
  463. width: 28upx;
  464. height: 28upx;
  465. margin-right: 20upx;
  466. }
  467. input{
  468. height: 60upx;
  469. line-height: 60upx;
  470. flex: 1;
  471. }
  472. }
  473. }
  474. .order-list{
  475. padding: 20upx;
  476. .item{
  477. background: #FFFFFF;
  478. border-radius: 16upx;
  479. padding: 0 30upx;
  480. margin-bottom: 20upx;
  481. .ordersn-box{
  482. display: flex;
  483. align-items: center;
  484. justify-content: space-between;
  485. padding: 34upx 0 20upx;
  486. .num{
  487. font-size: 26upx;
  488. font-family: PingFang SC;
  489. font-weight: 500;
  490. color: #999999;
  491. line-height: 1;
  492. }
  493. .status-box{
  494. display: flex;
  495. align-items: center;
  496. .recom-box{
  497. width: 108upx;
  498. height: 30upx;
  499. line-height: 30upx;
  500. text-align: left;
  501. padding-left: 8upx;
  502. font-size: 22upx;
  503. font-family: PingFang SC;
  504. font-weight: 500;
  505. color: #FFFFFF;
  506. background-image: url(https://jnlzjk-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/recom.png);
  507. background-repeat: no-repeat;
  508. background-size: 100% 100%;
  509. margin-right: 8upx;
  510. }
  511. .text{
  512. font-size: 28upx;
  513. font-family: PingFang SC;
  514. font-weight: 500;
  515. line-height: 1;
  516. &.success{
  517. color: #2BC7B9;
  518. }
  519. &.black{
  520. color: #111111;
  521. }
  522. &.info{
  523. color: #999999;
  524. }
  525. }
  526. }
  527. }
  528. .drug-list{
  529. .drug-item{
  530. padding: 30upx 0;
  531. border-bottom: 1px soli #F0F0F0;
  532. display: flex;
  533. align-items: center;
  534. .img-box{
  535. width: 160upx;
  536. height: 160upx;
  537. margin-right: 30upx;
  538. flex-shrink: 0;
  539. image{
  540. width: 100%;
  541. height: 100%;
  542. }
  543. }
  544. .drug-info{
  545. width: calc(100% - 190upx);
  546. height: 160upx;
  547. display: flex;
  548. flex-direction: column;
  549. justify-content: space-between;
  550. .name-box{
  551. font-size: 28upx;
  552. font-family: PingFang SC;
  553. font-weight: 500;
  554. color: #111111;
  555. line-height: 40upx;
  556. .tag{
  557. display: inline-block;
  558. padding: 0 6upx;
  559. height: 30upx;
  560. background: linear-gradient(90deg, #66b2ef 0%, #2BC7B9 100%);
  561. border-radius: 4upx;
  562. margin-right: 10upx;
  563. font-size: 22upx;
  564. font-family: PingFang SC;
  565. font-weight: bold;
  566. color: #FFFFFF;
  567. line-height: 30upx;
  568. float: left;
  569. margin-top: 7upx;
  570. }
  571. }
  572. .spec{
  573. font-size: 24upx;
  574. font-family: PingFang SC;
  575. font-weight: 500;
  576. color: #999999;
  577. line-height: 1;
  578. margin-top: 10upx;
  579. }
  580. .num-box{
  581. display: flex;
  582. align-items: center;
  583. justify-content: space-between;
  584. .price{
  585. display: flex;
  586. align-items: flex-end;
  587. .unit{
  588. font-size: 24upx;
  589. font-family: PingFang SC;
  590. font-weight: 500;
  591. color: #111111;
  592. line-height: 1.2;
  593. margin-right: 4upx;
  594. }
  595. .num{
  596. font-size: 32upx;
  597. font-family: PingFang SC;
  598. font-weight: 500;
  599. color: #111111;
  600. line-height: 1;
  601. }
  602. }
  603. .amount{
  604. font-size: 24upx;
  605. font-family: PingFang SC;
  606. font-weight: 500;
  607. color: #999999;
  608. line-height: 1;
  609. }
  610. }
  611. }
  612. }
  613. .bottom-box{
  614. height: 110upx;
  615. display: flex;
  616. align-items: center;
  617. justify-content: space-between;
  618. .amount-paid{
  619. display: flex;
  620. align-items: center;
  621. .label{
  622. font-size: 24upx;
  623. font-family: PingFang SC;
  624. font-weight: 500;
  625. color: #999999;
  626. line-height: 1;
  627. }
  628. .price-box{
  629. display: flex;
  630. align-items: flex-end;
  631. .unit{
  632. font-size: 24upx;
  633. font-family: PingFang SC;
  634. font-weight: 500;
  635. color: #FF6633;
  636. line-height: 1.2;
  637. margin-right: 4upx;
  638. }
  639. .num{
  640. font-size: 32upx;
  641. font-family: PingFang SC;
  642. font-weight: bold;
  643. color: #FF6633;
  644. line-height: 1;
  645. }
  646. }
  647. }
  648. .btn-box{
  649. box-sizing: border-box;
  650. display: flex;
  651. align-items: center;
  652. .btn{
  653. width: 155upx;
  654. height: 64upx;
  655. line-height: 64upx;
  656. font-size: 26upx;
  657. font-family: PingFang SC;
  658. font-weight: 500;
  659. text-align: center;
  660. border-radius: 32upx;
  661. margin-left: 15upx;
  662. &:first-child{
  663. margin-left: 0;
  664. }
  665. &.cancel{
  666. border: 1px solid #DDDDDD;
  667. color: #666666;
  668. }
  669. &.pay{
  670. background: #2BC7B9;
  671. color: #FFFFFF;
  672. }
  673. }
  674. }
  675. }
  676. }
  677. }
  678. }
  679. </style>