buyOrder.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474
  1. <template>
  2. <view class="content">
  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="item.val == orderStatusValue?'item active':'item'"
  11. @click="orderStatusChange(item)"
  12. >
  13. <view class="text">
  14. {{ item.name }}
  15. </view>
  16. </view>
  17. </view>
  18. </view>
  19. </view>
  20. <view class="consu-list">
  21. <mescroll-body top="88upx" ref="mescrollRef">
  22. <view v-for="(item,index) in dataList" :key="index" class="item" >
  23. <view class="item-top">
  24. <view class="item-title">
  25. <view class="ask-text">{{item.name}}</view>
  26. <view class="fs28">X {{item.num}}</view>
  27. </view>
  28. <view class="ask-time">购买次数:{{item.num}}</view>
  29. <view class="ask-time">购买时间:{{item.time}}</view>
  30. <view class="ask-time">备注:{{item.remark}}</view>
  31. </view>
  32. <view class="bottom-box">
  33. <view class="amount-paid">
  34. <text class="label">订单金额:</text>
  35. <view class="price-box">
  36. <view class="unit">¥</view>
  37. <view class="num">{{item.amount.toFixed(2)}}</view>
  38. </view>
  39. </view>
  40. <view class="btn-box">
  41. <view class="btn cancel" @click="cancel(item)">删除</view>
  42. <view class="btn pay" @click="showDetail(item)">编辑</view>
  43. </view>
  44. </view>
  45. </view>
  46. </mescroll-body>
  47. </view>
  48. <view class="btn-box2">
  49. <view class="sub-btn" @click="navgetTo(orderStatusValue)">
  50. <image src="/static/images/health/nav_add_icon24.png" class="w48 h48"></image>
  51. <text>新增</text>
  52. </view>
  53. </view>
  54. </view>
  55. </template>
  56. <script>
  57. import {getMyDoctorOrderList,cancelOrder} from '@/api/doctorOrder.js'
  58. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  59. export default {
  60. mixins: [MescrollMixin],
  61. data() {
  62. return {
  63. orderStatus:[
  64. {name:"购买服务信息",val:"0"},
  65. {name:"购买服务信息",val:"1"},
  66. ],
  67. orderStatusValue:0,
  68. mescroll:null,
  69. // 上拉加载的配置
  70. upOption: {
  71. onScroll:true,
  72. use: true, // 是否启用上拉加载; 默认true
  73. page: {
  74. num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
  75. size: 10 // 每页数据的数量,默认10
  76. },
  77. noMoreSize: 10, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
  78. empty: {
  79. icon:'/static/images/no_data.png',
  80. tip: '暂无数据'
  81. }
  82. },
  83. // 列表数据
  84. dataList: [
  85. {orderId:1, name:'极诺泰1',num:12,time:'2025-2-20 10:29',remark:'请尽快发货',amount:340.00,},
  86. {orderId:2, name:'极诺泰2',num:12,time:'2025-2-20 10:29',remark:'请尽快发货',amount:340.00,},
  87. {orderId:3, name:'极诺泰3',num:12,time:'2025-2-20 10:29',remark:'请尽快发货',amount:340.00,}
  88. ],
  89. dataList2: [
  90. {orderId:1, name:'竞品1',num:12,time:'2025-2-20 10:29',remark:'请尽快发货',amount:340.00,},
  91. {orderId:2, name:'竞品2',num:12,time:'2025-2-20 10:29',remark:'请尽快发货',amount:340.00,},
  92. {orderId:3, name:'竞品3',num:12,time:'2025-2-20 10:29',remark:'请尽快发货',amount:340.00,}
  93. ]
  94. }
  95. },
  96. onLoad() {
  97. // uni.$on('refreshDoctorOrder', () => {
  98. // this.mescroll.resetUpScroll()
  99. // })
  100. },
  101. methods: {
  102. pay(item){
  103. uni.navigateTo({
  104. url: '/pages_/doctor/paymentOrder?orderId='+item.orderId
  105. })
  106. },
  107. navgetTo(index){
  108. uni.navigateTo({
  109. url: index==0?'/pages_health/addServe':'/pages_health/addCompetitors'
  110. })
  111. },
  112. cancel(item){
  113. var that=this;
  114. uni.showModal({
  115. title: '提示',
  116. content: '确定取消订单吗',
  117. success: function (res) {
  118. if (res.confirm) {
  119. var data = {
  120. orderId:item.orderId
  121. };
  122. cancelOrder(data).then(res => {
  123. if(res.code==200){
  124. uni.showToast({
  125. icon:'success',
  126. title: '订单已取消',
  127. });
  128. that.mescroll.resetUpScroll()
  129. }else{
  130. uni.showToast({
  131. icon:'none',
  132. title: res.msg,
  133. });
  134. }
  135. });
  136. }
  137. else if (res.cancel) {
  138. }
  139. }
  140. });
  141. },
  142. // tab切换
  143. orderStatusChange(item) {
  144. this.orderStatusValue = item.val
  145. if(item.val==1){
  146. this.dataList=this.dataList2
  147. }
  148. this.mescroll.resetUpScroll()
  149. },
  150. mescrollInit(mescroll) {
  151. this.mescroll = mescroll;
  152. },
  153. /*下拉刷新的回调 */
  154. downCallback(mescroll) {
  155. mescroll.resetUpScroll()
  156. },
  157. upCallback(page) {
  158. //联网加载数据
  159. var that = this;
  160. var data = {
  161. status:this.orderStatusValue,
  162. page: page.num,
  163. pageSize: page.size
  164. };
  165. // getMyDoctorOrderList(data).then(res => {
  166. // if(res.code==200){
  167. // //设置列表数据
  168. // if (page.num == 1) {
  169. // that.dataList = res.data.list;
  170. // } else {
  171. // that.dataList = that.dataList.concat(res.data.list);
  172. // }
  173. // that.mescroll.endBySize(res.data.list.length, res.data.total);
  174. // }else{
  175. // uni.showToast({
  176. // icon:'none',
  177. // title: "请求失败",
  178. // });
  179. // that.dataList = null;
  180. // that.mescroll.endErr();
  181. // }
  182. // });
  183. },
  184. showDetail(item) {
  185. if(item.orderType==1){
  186. uni.navigateTo({
  187. url: '/pages_doctor/doctorOrderIM?orderId='+item.orderId
  188. })
  189. }
  190. }
  191. }
  192. }
  193. </script>
  194. <style lang="scss">
  195. .content{
  196. padding: 20upx;
  197. .top-fixed{
  198. width: 100%;
  199. position: fixed;
  200. top: 0;
  201. left: 0;
  202. z-index: 10;
  203. }
  204. .pub-tab-box{
  205. box-sizing: border-box;
  206. width: 100%;
  207. padding: 0 40upx;
  208. background-color: #FFFFFF;
  209. .tab-inner{
  210. height: 88upx;
  211. line-height: 88upx;
  212. display: flex;
  213. align-items: center;
  214. justify-content: center;
  215. overflow-x: auto;
  216. }
  217. .item{
  218. font-size: 28upx;
  219. white-space: nowrap;
  220. line-height: 1;
  221. font-family: PingFang SC;
  222. font-weight: 500;
  223. color: #666666;
  224. margin-right: 60upx;
  225. display: flex;
  226. align-items: center;
  227. justify-content: center;
  228. &:last-child{
  229. margin-right: 0;
  230. }
  231. &.active{
  232. font-weight: bold;
  233. color: #333333;
  234. &::after {
  235. content: "";
  236. width: 48rpx;
  237. height: 8rpx;
  238. background: linear-gradient(120deg, #31A1FE 0%, #008FD3 100%);
  239. position: absolute;
  240. bottom: 0;
  241. border-radius: 6upx 6upx 0upx 0;
  242. }
  243. }
  244. .text{
  245. position: relative;
  246. z-index: 1;
  247. }
  248. .tab-bg{
  249. width: 72upx;
  250. height: 28upx;
  251. position: absolute;
  252. top: 17upx;
  253. left: 50%;
  254. transform: translateX(-36upx);
  255. z-index: -1;
  256. }
  257. }
  258. }
  259. .btn-box2{
  260. z-index: 9999;
  261. width: 100%;
  262. padding: 30upx;
  263. position: fixed;
  264. bottom: 0;
  265. left: 0;
  266. box-sizing: border-box;
  267. // background: #FFFFFF;
  268. .sub-btn{
  269. width: 100%;
  270. height: 88upx;
  271. line-height: 88upx;
  272. text-align: center;
  273. font-size: 30upx;
  274. font-family: PingFang SC;
  275. font-weight: bold;
  276. color: #FFFFFF;
  277. background: #008FD3;
  278. border-radius: 44upx;
  279. display: flex;
  280. align-items: center;
  281. justify-content: center;
  282. image{
  283. margin-right: 16rpx;
  284. }
  285. }
  286. }
  287. .consu-list{
  288. .item{
  289. background: #FFFFFF;
  290. border-radius: 16upx;
  291. padding: 32rpx;
  292. position: relative;
  293. margin-bottom: 20upx;
  294. .item-top{
  295. padding-bottom:40rpx ;
  296. border-bottom: 1px solid #ECECEC;
  297. .item-title{
  298. display: flex;
  299. align-items: center;
  300. justify-content: space-between;
  301. margin-bottom: 12rpx;
  302. }
  303. .ask-text{
  304. font-family: PingFang SC;
  305. font-weight: 500;
  306. font-size: 36rpx;
  307. color: #222426;
  308. text-align: left;
  309. }
  310. .ask-time{
  311. font-size: 24rpx;
  312. color: #898E91;
  313. text-align: left;
  314. line-height: 40rpx;
  315. }
  316. }
  317. .ordersn-box{
  318. display: flex;
  319. align-items: center;
  320. justify-content: space-between;
  321. padding: 0upx 0 20upx;
  322. .num{
  323. font-size: 26upx;
  324. font-family: PingFang SC;
  325. font-weight: 500;
  326. color: #999999;
  327. line-height: 1;
  328. }
  329. .status-box{
  330. display: flex;
  331. align-items: center;
  332. .recom-box{
  333. width: 108upx;
  334. height: 30upx;
  335. line-height: 30upx;
  336. text-align: left;
  337. padding-left: 8upx;
  338. font-size: 22upx;
  339. font-family: PingFang SC;
  340. font-weight: 500;
  341. color: #FFFFFF;
  342. // background-image: url(../../static/images/recom.png);
  343. background-repeat: no-repeat;
  344. background-size: 100% 100%;
  345. margin-right: 8upx;
  346. }
  347. .text{
  348. font-size: 28upx;
  349. font-family: PingFang SC;
  350. font-weight: 500;
  351. line-height: 1;
  352. &.success{
  353. color: #0bb3f2;
  354. }
  355. &.black{
  356. color: #111111;
  357. }
  358. &.info{
  359. color: #999999;
  360. }
  361. }
  362. }
  363. }
  364. .doctor-info{
  365. display: flex;
  366. align-items: center;
  367. .img-box{
  368. width: 80upx;
  369. height: 80upx;
  370. background: #E0FFF8;
  371. border-radius: 50%;
  372. overflow: hidden;
  373. margin-right: 20upx;
  374. image{
  375. width: 100%;
  376. height: 100%;
  377. }
  378. }
  379. .name{
  380. font-size: 28upx;
  381. font-family: PingFang SC;
  382. font-weight: 500;
  383. color: #666666;
  384. line-height: 48upx;
  385. text{
  386. margin-right: 10upx;
  387. }
  388. }
  389. }
  390. .patient-text{
  391. font-size: 24upx;
  392. font-family: PingFang SC;
  393. font-weight: 500;
  394. color: #999999;
  395. margin-bottom: 24upx;
  396. }
  397. .bottom-box{
  398. height: 80upx;
  399. display: flex;
  400. align-items: center;
  401. justify-content: space-between;
  402. margin-top: 20rpx;
  403. .amount-paid{
  404. display: flex;
  405. align-items: center;
  406. .label{
  407. font-size: 24upx;
  408. font-family: PingFang SC;
  409. font-weight: 500;
  410. color: #999999;
  411. line-height: 1;
  412. }
  413. .price-box{
  414. display: flex;
  415. align-items: flex-end;
  416. .unit{
  417. font-size: 24upx;
  418. font-family: PingFang SC;
  419. font-weight: 600;
  420. color: #FF5030;
  421. line-height: 1.2;
  422. margin-right: 4upx;
  423. }
  424. .num{
  425. font-size: 36upx;
  426. font-family: PingFang SC;
  427. font-weight: bold;
  428. color: #FF5030;
  429. line-height: 1;
  430. }
  431. }
  432. }
  433. .btn-box{
  434. box-sizing: border-box;
  435. display: flex;
  436. align-items: center;
  437. .btn{
  438. width: 128rpx;
  439. height: 60rpx;
  440. line-height: 60upx;
  441. font-size: 24upx;
  442. font-family: PingFang SC;
  443. text-align: center;
  444. border-radius: 32upx;
  445. margin-left: 15upx;
  446. &:first-child{
  447. margin-left: 0;
  448. }
  449. &.cancel{
  450. border: 1px solid #B2B2B2;
  451. color: #666666;
  452. }
  453. &.pay{
  454. border: 1px solid #008FD3;
  455. color: #008FD3;
  456. }
  457. }
  458. }
  459. }
  460. }
  461. }
  462. }
  463. </style>