storeOrder.vue 19 KB

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