storeOrder.vue 14 KB

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