storeOrder.vue 15 KB

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