storeOrder.vue 15 KB

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