storeOrder.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546
  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. >
  13. <view class="text">
  14. {{ item.name }}
  15. <image v-show="status ==item.value" class="tab-bg" src="../../static/images/tab_bg.png" mode=""></image>
  16. </view>
  17. </view>
  18. </view>
  19. </view>
  20. <view class="search-cont">
  21. <view class="inner">
  22. <image class="icon-search" src="/static/images/search.png" mode=""></image>
  23. <input type="text" value="" placeholder="输入订单号" confirm-type="搜索" @confirm="goSearch" placeholder-style="font-size:28rpx;color:#BBBBBB;font-family: PingFang SC;" />
  24. </view>
  25. </view>
  26. </view>
  27. <view class="top-seat"></view>
  28. <!-- 订单列表 -->
  29. <mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption" :up="upOption">
  30. <view class="order-list">
  31. <view v-for="(item,index) in dataList" :key="index" class="item" >
  32. <!-- 订单号,状态 -->
  33. <view class="ordersn-box" @click="showDetail(item)">
  34. <view class="num">订单号:{{item.orderCode}}</view>
  35. <view class="status-box">
  36. <!-- <view class="recom-box">推荐订单</view> -->
  37. <text class="text success">
  38. {{utils.getDictLabelName("storeOrderStatus",item.status)}}
  39. </text>
  40. </view>
  41. </view>
  42. <!-- 药品列表 -->
  43. <view class="drug-list" >
  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. </view>
  103. </view>
  104. </mescroll-body>
  105. </view>
  106. </template>
  107. <script>
  108. import {getMyStoreOrderList,cancelOrder} from '@/api/storeOrder'
  109. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  110. export default {
  111. mixins: [MescrollMixin],
  112. data() {
  113. return {
  114. searchKey:"",
  115. status:0,
  116. orderStatus: [
  117. {name:"全部",value:""},
  118. {name:"待付款",value:"0"},
  119. {name:"待发货",value:"1"},
  120. {name:"待收货",value:"2"},
  121. {name:"已完成",value:"3"}
  122. ],
  123. mescroll:null,
  124. // 上拉加载的配置
  125. upOption: {
  126. onScroll:true,
  127. use: true, // 是否启用上拉加载; 默认true
  128. page: {
  129. num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
  130. size: 10 // 每页数据的数量,默认10
  131. },
  132. noMoreSize: 10, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
  133. empty: {
  134. icon:'/static/images/no_data.png',
  135. tip: '暂无数据'
  136. }
  137. },
  138. // 列表数据
  139. dataList: [],
  140. };
  141. },
  142. onLoad(option) {
  143. this.status = option.status
  144. var that=this;
  145. uni.$on('refreshOrder', () => {
  146. that.mescroll.resetUpScroll()
  147. })
  148. },
  149. methods: {
  150. goSearch(e) {
  151. this.searchKey=e.detail.value;
  152. this.mescroll.resetUpScroll()
  153. },
  154. refund(item) {
  155. uni.navigateTo({
  156. url: './refundOrderProduct?orderId='+item.id
  157. })
  158. },
  159. // tab切换
  160. orderStatusChange(item) {
  161. this.status = item.value
  162. this.mescroll.resetUpScroll()
  163. },
  164. mescrollInit(mescroll) {
  165. this.mescroll = mescroll;
  166. },
  167. /*下拉刷新的回调 */
  168. downCallback(mescroll) {
  169. mescroll.resetUpScroll()
  170. },
  171. upCallback(page) {
  172. //联网加载数据
  173. var that = this;
  174. var data = {
  175. keyword:this.searchKey,
  176. status:this.status,
  177. page: page.num,
  178. pageSize: page.size
  179. };
  180. getMyStoreOrderList(data).then(res => {
  181. if(res.code==200){
  182. //设置列表数据
  183. if (page.num == 1) {
  184. that.dataList = res.data.list;
  185. // console.log(res)
  186. } else {
  187. that.dataList = that.dataList.concat(res.data.list);
  188. }
  189. that.mescroll.endBySize(res.data.list.length, res.data.total);
  190. }else{
  191. uni.showToast({
  192. icon:'none',
  193. title: "请求失败",
  194. });
  195. that.dataList = null;
  196. that.mescroll.endErr();
  197. }
  198. });
  199. },
  200. // 查看订单详情
  201. showDetail(item) {
  202. console.log(item)
  203. uni.navigateTo({
  204. url: './storeOrderDetail?id=' + item.id
  205. })
  206. },
  207. cancel(item){
  208. var that=this;
  209. uni.showModal({
  210. title: '提示',
  211. content: '确定取消订单吗',
  212. success: function (res) {
  213. if (res.confirm) {
  214. var data = {
  215. orderId:item.id
  216. };
  217. cancelOrder(data).then(res => {
  218. if(res.code==200){
  219. uni.showToast({
  220. icon:'success',
  221. title: "操作成功",
  222. });
  223. that.mescroll.resetUpScroll()
  224. }else{
  225. uni.showToast({
  226. icon:'none',
  227. title: res.msg,
  228. });
  229. }
  230. });
  231. }
  232. else if (res.cancel) {
  233. }
  234. }
  235. });
  236. },
  237. pay(item) {
  238. console.log(item)
  239. uni.navigateTo({
  240. url: '/pages/shopping/paymentOrder?orderId='+item.id
  241. })
  242. },
  243. // 查看物流
  244. showDelivery(item) {
  245. uni.navigateTo({
  246. url: './storeOrderDelivery?orderId='+item.id
  247. })
  248. }
  249. }
  250. }
  251. </script>
  252. <style lang="scss">
  253. .top-fixed{
  254. width: 100%;
  255. position: fixed;
  256. top: 0;
  257. left: 0;
  258. z-index: 10;
  259. }
  260. .pub-tab-box{
  261. box-sizing: border-box;
  262. width: 100%;
  263. padding: 0 40upx;
  264. background-color: #FFFFFF;
  265. .tab-inner{
  266. height: 88upx;
  267. line-height: 88upx;
  268. display: flex;
  269. align-items: center;
  270. justify-content: space-between;
  271. overflow-x: auto;
  272. }
  273. .item{
  274. font-size: 28upx;
  275. white-space: nowrap;
  276. line-height: 1;
  277. font-family: PingFang SC;
  278. font-weight: 500;
  279. color: #666666;
  280. margin-right: 60upx;
  281. display: flex;
  282. align-items: center;
  283. justify-content: center;
  284. &:last-child{
  285. margin-right: 0;
  286. }
  287. &.active{
  288. font-weight: bold;
  289. color: #333333;
  290. }
  291. .text{
  292. position: relative;
  293. z-index: 1;
  294. }
  295. .tab-bg{
  296. width: 72upx;
  297. height: 28upx;
  298. position: absolute;
  299. top: 17upx;
  300. left: 50%;
  301. transform: translateX(-36upx);
  302. z-index: -1;
  303. }
  304. }
  305. }
  306. .top-seat{
  307. width: 100%;
  308. height: 192upx;
  309. }
  310. .search-cont{
  311. padding: 16upx 30upx;
  312. background-color: #FFFFFF;
  313. .inner{
  314. box-sizing: border-box;
  315. width: 100%;
  316. height: 72upx;
  317. background: #F7F7F7;
  318. border-radius: 36upx;
  319. display: flex;
  320. align-items: center;
  321. padding: 0 30upx;
  322. .icon-search{
  323. width: 28upx;
  324. height: 28upx;
  325. margin-right: 20upx;
  326. }
  327. input{
  328. height: 60upx;
  329. line-height: 60upx;
  330. flex: 1;
  331. }
  332. }
  333. }
  334. .order-list{
  335. padding: 20upx;
  336. .item{
  337. background: #FFFFFF;
  338. border-radius: 16upx;
  339. padding: 0 30upx;
  340. margin-bottom: 20upx;
  341. .ordersn-box{
  342. display: flex;
  343. align-items: center;
  344. justify-content: space-between;
  345. padding: 34upx 0 20upx;
  346. .num{
  347. font-size: 26upx;
  348. font-family: PingFang SC;
  349. font-weight: 500;
  350. color: #999999;
  351. line-height: 1;
  352. }
  353. .status-box{
  354. display: flex;
  355. align-items: center;
  356. .recom-box{
  357. width: 108upx;
  358. height: 30upx;
  359. line-height: 30upx;
  360. text-align: left;
  361. padding-left: 8upx;
  362. font-size: 22upx;
  363. font-family: PingFang SC;
  364. font-weight: 500;
  365. color: #FFFFFF;
  366. background-image: url(../../static/images/recom.png);
  367. background-repeat: no-repeat;
  368. background-size: 100% 100%;
  369. margin-right: 8upx;
  370. }
  371. .text{
  372. font-size: 28upx;
  373. font-family: PingFang SC;
  374. font-weight: 500;
  375. line-height: 1;
  376. &.success{
  377. color: #2BC7B9;
  378. }
  379. &.black{
  380. color: #111111;
  381. }
  382. &.info{
  383. color: #999999;
  384. }
  385. }
  386. }
  387. }
  388. .drug-list{
  389. .drug-item{
  390. padding: 30upx 0;
  391. border-bottom: 1px soli #F0F0F0;
  392. display: flex;
  393. align-items: center;
  394. .img-box{
  395. width: 160upx;
  396. height: 160upx;
  397. margin-right: 30upx;
  398. flex-shrink: 0;
  399. image{
  400. width: 100%;
  401. height: 100%;
  402. }
  403. }
  404. .drug-info{
  405. width: calc(100% - 190upx);
  406. height: 160upx;
  407. display: flex;
  408. flex-direction: column;
  409. justify-content: space-between;
  410. .name-box{
  411. font-size: 28upx;
  412. font-family: PingFang SC;
  413. font-weight: 500;
  414. color: #111111;
  415. line-height: 40upx;
  416. .tag{
  417. display: inline-block;
  418. padding: 0 6upx;
  419. height: 30upx;
  420. background: linear-gradient(90deg, #2BC7B9 0%, #2BC7A4 100%);
  421. border-radius: 4upx;
  422. margin-right: 10upx;
  423. font-size: 22upx;
  424. font-family: PingFang SC;
  425. font-weight: bold;
  426. color: #FFFFFF;
  427. line-height: 30upx;
  428. float: left;
  429. margin-top: 7upx;
  430. }
  431. }
  432. .spec{
  433. font-size: 24upx;
  434. font-family: PingFang SC;
  435. font-weight: 500;
  436. color: #999999;
  437. line-height: 1;
  438. margin-top: 10upx;
  439. }
  440. .num-box{
  441. display: flex;
  442. align-items: center;
  443. justify-content: space-between;
  444. .price{
  445. display: flex;
  446. align-items: flex-end;
  447. .unit{
  448. font-size: 24upx;
  449. font-family: PingFang SC;
  450. font-weight: 500;
  451. color: #111111;
  452. line-height: 1.2;
  453. margin-right: 4upx;
  454. }
  455. .num{
  456. font-size: 32upx;
  457. font-family: PingFang SC;
  458. font-weight: 500;
  459. color: #111111;
  460. line-height: 1;
  461. }
  462. }
  463. .amount{
  464. font-size: 24upx;
  465. font-family: PingFang SC;
  466. font-weight: 500;
  467. color: #999999;
  468. line-height: 1;
  469. }
  470. }
  471. }
  472. }
  473. .bottom-box{
  474. height: 110upx;
  475. display: flex;
  476. align-items: center;
  477. justify-content: space-between;
  478. .amount-paid{
  479. display: flex;
  480. align-items: center;
  481. .label{
  482. font-size: 24upx;
  483. font-family: PingFang SC;
  484. font-weight: 500;
  485. color: #999999;
  486. line-height: 1;
  487. }
  488. .price-box{
  489. display: flex;
  490. align-items: flex-end;
  491. .unit{
  492. font-size: 24upx;
  493. font-family: PingFang SC;
  494. font-weight: 500;
  495. color: #FF6633;
  496. line-height: 1.2;
  497. margin-right: 4upx;
  498. }
  499. .num{
  500. font-size: 32upx;
  501. font-family: PingFang SC;
  502. font-weight: bold;
  503. color: #FF6633;
  504. line-height: 1;
  505. }
  506. }
  507. }
  508. .btn-box{
  509. box-sizing: border-box;
  510. display: flex;
  511. align-items: center;
  512. .btn{
  513. width: 155upx;
  514. height: 64upx;
  515. line-height: 64upx;
  516. font-size: 26upx;
  517. font-family: PingFang SC;
  518. font-weight: 500;
  519. text-align: center;
  520. border-radius: 32upx;
  521. margin-left: 15upx;
  522. &:first-child{
  523. margin-left: 0;
  524. }
  525. &.cancel{
  526. border: 1px solid #DDDDDD;
  527. color: #666666;
  528. }
  529. &.pay{
  530. background: #2BC7B9;
  531. color: #FFFFFF;
  532. }
  533. }
  534. }
  535. }
  536. }
  537. }
  538. }
  539. </style>