storeOrder.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556
  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. this.getDicts();
  149. },
  150. methods: {getDicts: function() {
  151. getDicts().then(
  152. res => {
  153. if (res.code == 200) {
  154. uni.setStorageSync('dicts', JSON.stringify(res));
  155. }
  156. },
  157. rej => {}
  158. );
  159. },
  160. goSearch(e) {
  161. this.searchKey=e.detail.value;
  162. this.mescroll.resetUpScroll()
  163. },
  164. refund(item) {
  165. uni.navigateTo({
  166. url: './refundOrderProduct?orderId='+item.id
  167. })
  168. },
  169. // tab切换
  170. orderStatusChange(item) {
  171. this.status = item.value
  172. this.mescroll.resetUpScroll()
  173. },
  174. mescrollInit(mescroll) {
  175. this.mescroll = mescroll;
  176. },
  177. /*下拉刷新的回调 */
  178. downCallback(mescroll) {
  179. mescroll.resetUpScroll()
  180. },
  181. upCallback(page) {
  182. //联网加载数据
  183. var that = this;
  184. var data = {
  185. keyword:this.searchKey,
  186. status:this.status,
  187. page: page.num,
  188. pageSize: page.size
  189. };
  190. getMyStoreOrderList(data).then(res => {
  191. if(res.code==200){
  192. //设置列表数据
  193. if (page.num == 1) {
  194. that.dataList = res.data.list;
  195. // console.log(res)
  196. } else {
  197. that.dataList = that.dataList.concat(res.data.list);
  198. }
  199. that.mescroll.endBySize(res.data.list.length, res.data.total);
  200. }else{
  201. uni.showToast({
  202. icon:'none',
  203. title: "请求失败",
  204. });
  205. that.dataList = null;
  206. that.mescroll.endErr();
  207. }
  208. });
  209. },
  210. // 查看订单详情
  211. showDetail(item) {
  212. console.log(item)
  213. uni.navigateTo({
  214. url: './storeOrderDetail?id=' + item.id
  215. })
  216. },
  217. cancel(item){
  218. var that=this;
  219. uni.showModal({
  220. title: '提示',
  221. content: '确定取消订单吗',
  222. success: function (res) {
  223. if (res.confirm) {
  224. var data = {
  225. orderId:item.id
  226. };
  227. cancelOrder(data).then(res => {
  228. if(res.code==200){
  229. uni.showToast({
  230. icon:'success',
  231. title: "操作成功",
  232. });
  233. that.mescroll.resetUpScroll()
  234. }else{
  235. uni.showToast({
  236. icon:'none',
  237. title: res.msg,
  238. });
  239. }
  240. });
  241. }
  242. else if (res.cancel) {
  243. }
  244. }
  245. });
  246. },
  247. pay(item) {
  248. console.log(item)
  249. uni.navigateTo({
  250. url: '/pages_shopping/shopping/paymentOrder?orderId='+item.id
  251. })
  252. },
  253. // 查看物流
  254. showDelivery(item) {
  255. uni.navigateTo({
  256. url: './storeOrderDelivery?orderId='+item.id
  257. })
  258. }
  259. }
  260. }
  261. </script>
  262. <style lang="scss">
  263. .top-fixed{
  264. width: 100%;
  265. position: fixed;
  266. top: 0;
  267. left: 0;
  268. z-index: 10;
  269. }
  270. .pub-tab-box{
  271. box-sizing: border-box;
  272. width: 100%;
  273. padding: 0 40upx;
  274. background-color: #FFFFFF;
  275. .tab-inner{
  276. height: 88upx;
  277. line-height: 88upx;
  278. display: flex;
  279. align-items: center;
  280. justify-content: space-between;
  281. overflow-x: auto;
  282. }
  283. .item{
  284. font-size: 28upx;
  285. white-space: nowrap;
  286. line-height: 1;
  287. font-family: PingFang SC;
  288. font-weight: 500;
  289. color: #666666;
  290. margin-right: 60upx;
  291. display: flex;
  292. align-items: center;
  293. justify-content: center;
  294. &:last-child{
  295. margin-right: 0;
  296. }
  297. &.active{
  298. font-weight: bold;
  299. color: #333333;
  300. }
  301. .text{
  302. position: relative;
  303. z-index: 1;
  304. }
  305. .tab-bg{
  306. width: 72upx;
  307. height: 28upx;
  308. position: absolute;
  309. top: 17upx;
  310. left: 50%;
  311. transform: translateX(-36upx);
  312. z-index: -1;
  313. }
  314. }
  315. }
  316. .top-seat{
  317. width: 100%;
  318. height: 192upx;
  319. }
  320. .search-cont{
  321. padding: 16upx 30upx;
  322. background-color: #FFFFFF;
  323. .inner{
  324. box-sizing: border-box;
  325. width: 100%;
  326. height: 72upx;
  327. background: #F7F7F7;
  328. border-radius: 36upx;
  329. display: flex;
  330. align-items: center;
  331. padding: 0 30upx;
  332. .icon-search{
  333. width: 28upx;
  334. height: 28upx;
  335. margin-right: 20upx;
  336. }
  337. input{
  338. height: 60upx;
  339. line-height: 60upx;
  340. flex: 1;
  341. }
  342. }
  343. }
  344. .order-list{
  345. padding: 20upx;
  346. .item{
  347. background: #FFFFFF;
  348. border-radius: 16upx;
  349. padding: 0 30upx;
  350. margin-bottom: 20upx;
  351. .ordersn-box{
  352. display: flex;
  353. align-items: center;
  354. justify-content: space-between;
  355. padding: 34upx 0 20upx;
  356. .num{
  357. font-size: 26upx;
  358. font-family: PingFang SC;
  359. font-weight: 500;
  360. color: #999999;
  361. line-height: 1;
  362. }
  363. .status-box{
  364. display: flex;
  365. align-items: center;
  366. .recom-box{
  367. width: 108upx;
  368. height: 30upx;
  369. line-height: 30upx;
  370. text-align: left;
  371. padding-left: 8upx;
  372. font-size: 22upx;
  373. font-family: PingFang SC;
  374. font-weight: 500;
  375. color: #FFFFFF;
  376. background-image: url(../../static/images/recom.png);
  377. background-repeat: no-repeat;
  378. background-size: 100% 100%;
  379. margin-right: 8upx;
  380. }
  381. .text{
  382. font-size: 28upx;
  383. font-family: PingFang SC;
  384. font-weight: 500;
  385. line-height: 1;
  386. &.success{
  387. color: #2BC7B9;
  388. }
  389. &.black{
  390. color: #111111;
  391. }
  392. &.info{
  393. color: #999999;
  394. }
  395. }
  396. }
  397. }
  398. .drug-list{
  399. .drug-item{
  400. padding: 30upx 0;
  401. border-bottom: 1px soli #F0F0F0;
  402. display: flex;
  403. align-items: center;
  404. .img-box{
  405. width: 160upx;
  406. height: 160upx;
  407. margin-right: 30upx;
  408. flex-shrink: 0;
  409. image{
  410. width: 100%;
  411. height: 100%;
  412. }
  413. }
  414. .drug-info{
  415. width: calc(100% - 190upx);
  416. height: 160upx;
  417. display: flex;
  418. flex-direction: column;
  419. justify-content: space-between;
  420. .name-box{
  421. font-size: 28upx;
  422. font-family: PingFang SC;
  423. font-weight: 500;
  424. color: #111111;
  425. line-height: 40upx;
  426. .tag{
  427. display: inline-block;
  428. padding: 0 6upx;
  429. height: 30upx;
  430. background: linear-gradient(90deg, #2BC7B9 0%, #2BC7A4 100%);
  431. border-radius: 4upx;
  432. margin-right: 10upx;
  433. font-size: 22upx;
  434. font-family: PingFang SC;
  435. font-weight: bold;
  436. color: #FFFFFF;
  437. line-height: 30upx;
  438. float: left;
  439. margin-top: 7upx;
  440. }
  441. }
  442. .spec{
  443. font-size: 24upx;
  444. font-family: PingFang SC;
  445. font-weight: 500;
  446. color: #999999;
  447. line-height: 1;
  448. margin-top: 10upx;
  449. }
  450. .num-box{
  451. display: flex;
  452. align-items: center;
  453. justify-content: space-between;
  454. .price{
  455. display: flex;
  456. align-items: flex-end;
  457. .unit{
  458. font-size: 24upx;
  459. font-family: PingFang SC;
  460. font-weight: 500;
  461. color: #111111;
  462. line-height: 1.2;
  463. margin-right: 4upx;
  464. }
  465. .num{
  466. font-size: 32upx;
  467. font-family: PingFang SC;
  468. font-weight: 500;
  469. color: #111111;
  470. line-height: 1;
  471. }
  472. }
  473. .amount{
  474. font-size: 24upx;
  475. font-family: PingFang SC;
  476. font-weight: 500;
  477. color: #999999;
  478. line-height: 1;
  479. }
  480. }
  481. }
  482. }
  483. .bottom-box{
  484. height: 110upx;
  485. display: flex;
  486. align-items: center;
  487. justify-content: space-between;
  488. .amount-paid{
  489. display: flex;
  490. align-items: center;
  491. .label{
  492. font-size: 24upx;
  493. font-family: PingFang SC;
  494. font-weight: 500;
  495. color: #999999;
  496. line-height: 1;
  497. }
  498. .price-box{
  499. display: flex;
  500. align-items: flex-end;
  501. .unit{
  502. font-size: 24upx;
  503. font-family: PingFang SC;
  504. font-weight: 500;
  505. color: #FF6633;
  506. line-height: 1.2;
  507. margin-right: 4upx;
  508. }
  509. .num{
  510. font-size: 32upx;
  511. font-family: PingFang SC;
  512. font-weight: bold;
  513. color: #FF6633;
  514. line-height: 1;
  515. }
  516. }
  517. }
  518. .btn-box{
  519. box-sizing: border-box;
  520. display: flex;
  521. align-items: center;
  522. .btn{
  523. width: 155upx;
  524. height: 64upx;
  525. line-height: 64upx;
  526. font-size: 26upx;
  527. font-family: PingFang SC;
  528. font-weight: 500;
  529. text-align: center;
  530. border-radius: 32upx;
  531. margin-left: 15upx;
  532. &:first-child{
  533. margin-left: 0;
  534. }
  535. &.cancel{
  536. border: 1px solid #DDDDDD;
  537. color: #666666;
  538. }
  539. &.pay{
  540. background: #2BC7B9;
  541. color: #FFFFFF;
  542. }
  543. }
  544. }
  545. }
  546. }
  547. }
  548. }
  549. </style>