list.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645
  1. <template>
  2. <view class="content">
  3. <view class="top">
  4. <u-navbar title=" " @leftClick="leftClick" height="44px" bgColor="rgb(255,255,255)" :placeholder="true">
  5. <view class="u-nav-slot" slot="center">
  6. <u-search placeholder="搜索我的订单" v-model="keyword" :showAction="false" @search="search"></u-search>
  7. </view>
  8. </u-navbar>
  9. <view class="tabs hflex acenter jbetween">
  10. <block v-for="(item,index) in tabs" :key="index">
  11. <view class="tab_item" :class="tab_active == item.index?'tab_active':''" @click="changeTab(item.index)">{{item.name}}</view>
  12. </block>
  13. </view>
  14. </view>
  15. <view class="box">
  16. <block v-for="(item,index) in pageList" :key="index">
  17. <view class="box_item">
  18. <view class="hflex acenter jbetween cell">
  19. <view class="hflex acenter">
  20. <view class="title">{{item.admin_name}}</view>
  21. <u-icon color="#B5B5B5" name="arrow-right" size="10"></u-icon>
  22. </view>
  23. <!-- <view class="text-blue">{{status}}</view> -->
  24. <view class="text-blue text-white" v-if="item.status == 0">已取消</view>
  25. <view class="text-blue" v-else-if="item.status == 1">预订单</view>
  26. <view class="text-blue" v-else-if="item.status == 2">待支付</view>
  27. <view class="text-blue" v-else-if="item.status == 3">支付中</view>
  28. <view class="text-blue" v-else-if="item.status == 4">待发货</view>
  29. <view class="text-blue" v-else-if="item.status == 5">待收货</view>
  30. <view class="text-blue" v-else-if="item.status == 6">已完成</view>
  31. <!-- <view class="text-blue" v-else-if="item.refund_status == 2">已取消</view>
  32. <view class="text-blue" v-else-if="item.refund_status == 1 ">已取消</view> -->
  33. <view class="text-blue" v-else-if="item.status == 7">待发货</view>
  34. <view class="text-blue" v-if="item.status == 8">已取消</view>
  35. </view>
  36. <view @click="toOrderDetail(item.id)">
  37. <view class="hflex acenter" v-if="item.goods_item.length == 1">
  38. <view>
  39. <image :src="item.goods_item[0].goods_cover" mode="aspectFill" class="img"></image>
  40. </view>
  41. <view class="img_right">
  42. <view class="hflex acenter jbetween">
  43. <view class="name text_hide">{{item.goods_item[0].goods_name}}</view>
  44. <view class="price">¥{{item.goods_item[0].price_selling}}</view>
  45. </view>
  46. <view class="hflex jbetween" style="padding-top: 12rpx;">
  47. <view class="norm text_hide">{{item.goods_item[0].goods_spec}}</view>
  48. <view class="vflex">
  49. <view class="num">X{{item.goods_item[0].stock_sales}}</view>
  50. <view class="text_red" v-if="item.refund_status == 1">退款中</view>
  51. <view class="text_red" v-if="item.refund_status == 2">退款成功</view>
  52. <view class="text_red" v-if="item.refund_status == 3">退款关闭</view>
  53. </view>
  54. </view>
  55. </view>
  56. </view>
  57. <view class="scroll_img" v-else>
  58. <scroll-view scroll-x="true" style="white-space: nowrap;" class="imgs hflex">
  59. <block v-for="(item2,index2) in item.goods_item" :key="index2">
  60. <view class="imgs_item">
  61. <image :src="item2.goods_cover" class="img"></image>
  62. </view>
  63. </block>
  64. </scroll-view>
  65. <view class="img_leng">共{{item.goods_item.length}}件</view>
  66. </view>
  67. </view>
  68. <view class="hflex acenter jend cell">
  69. <view class="price">实付款:¥{{item.payment_amount}}</view>
  70. </view>
  71. <view class="hflex acenter jend cell">
  72. <block v-if="item.status == 2">
  73. <view class="btn1" @click="cancelShow(item.id)">取消订单</view>
  74. <view class="btn1 btn2" @click="pay(index)">立即支付</view>
  75. </block>
  76. <block v-if="item.status == 4">
  77. <view class="btn1" @click="toApply(item.id)">申请退款</view>
  78. <view class="btn1 btn2" @click="remind(item.id)">提醒发货</view>
  79. </block>
  80. <block v-if="item.status == 5">
  81. <view class="btn1 btn2" @click="take(item.id)">确认收货</view>
  82. </block>
  83. <block v-if="item.status == 6 || item.refund_status == 2">
  84. <!-- <view class="btn1">发表评价</view> -->
  85. <!-- <view class="btn1 btn2" @click="toBuy(index)">再次购买</view> -->
  86. </block>
  87. <block v-if="item.refund_status == 1 && item.status != 6">
  88. <!-- <view class="btn1">发表评价</view> -->
  89. <!-- <view class="btn1" @click="remind(item.id)">提醒发货</view> -->
  90. <view class="btn1 btn2" @click="cancel(item.id)">撤销申请</view>
  91. </block>
  92. </view>
  93. </view>
  94. </block>
  95. </view>
  96. <u-popup :show="cancel_show" :round="20" :closeable="true" mode="bottom" @close="close">
  97. <view class="popu">
  98. <view class="popu_title">订单取消原因</view>
  99. <view class="text_style2">请选择取消订单的原因(必选)</view>
  100. <u-radio-group v-model="cancelReason" placement="column">
  101. <block v-for="(item, index) in cancelList" :key="index" >
  102. <u-radio :name="item.name" @change="radioChange" :customStyle="{padding: '28rpx 0'}" :label="item.name"></u-radio>
  103. </block>
  104. </u-radio-group>
  105. <view class="btn_group hflex acenter jbetween">
  106. <view class="cancel_btn" @click="close">我再想想</view>
  107. <view class="sure_btn" @click="cancelOrder">取消订单</view>
  108. </view>
  109. </view>
  110. </u-popup>
  111. </view>
  112. </template>
  113. <script>
  114. import $api from '@/static/js/api.js'
  115. var that = ''
  116. export default {
  117. data() {
  118. return {
  119. keyword: '',
  120. tabs: [
  121. {
  122. name: '全部',
  123. index: 1
  124. },
  125. {
  126. name: '待付款',
  127. index: 2
  128. },
  129. {
  130. name: '待发货',
  131. index: 3
  132. },
  133. {
  134. name: '待收货',
  135. index: 4
  136. },
  137. {
  138. name: '已完成',
  139. index: 6
  140. }
  141. ],
  142. tab_active: 1,
  143. pageList: [
  144. ],
  145. id: '',
  146. cancel_show: false,
  147. cancelList: [
  148. {
  149. name: '商品无货'
  150. },
  151. {
  152. name: '发货时间问题'
  153. },
  154. {
  155. name: '不想要了'
  156. },
  157. {
  158. name: '商品错选/多选'
  159. },
  160. {
  161. name: '地址信息填写错误'
  162. },
  163. {
  164. name: '其他原因'
  165. }
  166. ],
  167. cancelReason: '',
  168. page:1,
  169. limit: 10,
  170. total:1.,
  171. // status: '',
  172. }
  173. },
  174. onLoad(options) {
  175. that = this
  176. that.tab_active = Number(options.id)
  177. that.getList()
  178. },
  179. onPullDownRefresh() {
  180. that.page = 1
  181. that.getList()
  182. },
  183. methods: {
  184. // 返回
  185. leftClick() {
  186. console.log('返回');
  187. $api.jump(-1)
  188. },
  189. // 获取我的订单
  190. getList() {
  191. $api.req({
  192. url: '/data/api.Order/order_list',
  193. method: 'POST',
  194. data: {
  195. order_name: that.keyword?that.keyword: '',
  196. status: that.tab_active,
  197. page: that.page
  198. }
  199. }, function(res) {
  200. if(res.code == 1) {
  201. for(var i=0;i<res.data.list.length;i++) {
  202. for(var j=0;j<res.data.list[i].goods_item.length;j++) {
  203. res.data.list[i].goods_item[j].goods_spec = $api.resetspec(res.data.list[i].goods_item[j].goods_spec)
  204. }
  205. }
  206. if(that.page == 1) {
  207. that.pageList = res.data.list
  208. } else {
  209. that.pageList = that.pageList.concat(res.data.list)
  210. }
  211. that.total = res.data.page.total
  212. that.limit = res.data.page.limit
  213. }
  214. uni.stopPullDownRefresh();
  215. })
  216. },
  217. changeTab(index) {
  218. /* console.log(index);
  219. if(index == 4) {
  220. that.tab_active = 5
  221. } else {
  222. that.tab_active = index
  223. } */
  224. that.tab_active = index
  225. that.page = 1
  226. that.pageList = []
  227. that.getList()
  228. },
  229. // 店铺
  230. toShop(id) {
  231. $api.jump('/page_shop/pages/good/shop?id=' + id)
  232. },
  233. toOrderDetail(id) {
  234. $api.jump('/page_shop/pages/order/orderdetail?id=' + id)
  235. },
  236. // 申请退款
  237. toApply(id) {
  238. $api.jump('/page_shop/pages/order/apply?id=' + id)
  239. },
  240. toBuy(index) {
  241. var item_id = that.pageList[index].goods_item[0].item_id
  242. var url = '/page_shop/pages/good/submit2?data=' + JSON.stringify(that.pageList[index]) + '&item_id=' + item_id
  243. $api.jump(url)
  244. // $api.jump('/page_shop/pages/good/detail?id=' + that.pageList[index].id)
  245. },
  246. cancel(id) {
  247. $api.req({
  248. url: '/data/api.Order/cancel_refund',
  249. method: 'POST',
  250. data: {
  251. order_id: id
  252. }
  253. }, function(res) {
  254. if(res.code == 1) {
  255. that.page = 1
  256. that.getList()
  257. }
  258. })
  259. },
  260. search(e) {
  261. that.page = 1
  262. that.getList()
  263. },
  264. cancelShow(id) {
  265. that.id = id
  266. that.cancel_show = true
  267. },
  268. pay(index) {
  269. var openid = uni.getStorageSync('openid1')
  270. /* if(!openid) {
  271. $api.info("登录验证有误,请重新登录")
  272. return
  273. } */
  274. $api.req({
  275. url: '/data/api.auth.Center/channel',
  276. method: 'POST',
  277. data: {
  278. type: 2,
  279. from: 1
  280. }
  281. }, function(res) {
  282. if(res.code == 1) {
  283. var pay_code = res.data[0].code
  284. $api.req({
  285. url: '/data/api.Order/order_pay',
  286. method: 'POST',
  287. data: {
  288. pay_code: pay_code,
  289. pay_no: that.pageList[index].payment_trade,
  290. type: 'wechat'
  291. }
  292. }, function(res) {
  293. if(res.code == 1) {
  294. wx.requestPayment({
  295. timeStamp: res.data.pay.timeStamp,
  296. nonceStr: res.data.pay.nonceStr,
  297. package: res.data.pay.package,
  298. signType: 'MD5',
  299. paySign: res.data.pay.paySign,
  300. success (res) {
  301. $api.info("支付成功")
  302. that.getList()
  303. },
  304. fail (res) { }
  305. })
  306. }
  307. })
  308. }
  309. })
  310. },
  311. close() {
  312. that.cancel_show = false
  313. },
  314. // 选择取消原因
  315. radioChange(e) {
  316. that.cancelReason = e
  317. },
  318. // 确认取消
  319. cancelOrder() {
  320. if(that.cancelReason == '') {
  321. $api.info('请选择取消订单的原因')
  322. } else {
  323. $api.req({
  324. url: '/data/api.Order/cancel_order',
  325. method: 'POST',
  326. data: {
  327. order_id: that.id,
  328. cancel_remark: that.cancelReason
  329. }
  330. }, function(res) {
  331. if(res.code == 1) {
  332. $api.info(res.info)
  333. that.close()
  334. that.page = 1
  335. that.getList()
  336. }
  337. })
  338. }
  339. },
  340. take(id) {
  341. $api.req({
  342. url: '/data/api.Order/order_end',
  343. method: 'POST',
  344. data: {
  345. order_id: id
  346. }
  347. }, function(res) {
  348. if(res.code == 1) {
  349. $api.info(res.info)
  350. that.getList()
  351. }
  352. })
  353. },
  354. remind(id) {
  355. $api.req({
  356. url: '/data/api.Order/remind',
  357. method: 'POST',
  358. data: {
  359. order_id: id
  360. }
  361. }, function(res) {
  362. if(res.code == 1) {
  363. $api.info(res.info)
  364. }
  365. })
  366. },
  367. onReachBottom() {
  368. if (Number(that.page) * Number(that.limit) >= Number(that.total)) {
  369. $api.info("没有更多了")
  370. } else {
  371. that.page++
  372. that.getList()
  373. }
  374. }
  375. },
  376. }
  377. </script>
  378. <style lang="scss" scoped>
  379. .content {
  380. background: #F3F3F3;
  381. .top {
  382. box-sizing: border-box;
  383. // padding: 30rpx;
  384. // height: 540rpx;
  385. .u-nav-slot {
  386. position: absolute;
  387. top: 8rpx;
  388. left: 134rpx;
  389. }
  390. .tabs {
  391. background-color: #fff;
  392. width: 100%;
  393. box-sizing: border-box;
  394. padding: 20rpx 30rpx;
  395. .tab_item {
  396. font-size: 32rpx;
  397. font-weight: 400;
  398. color: #333333;
  399. line-height: 44rpx;
  400. }
  401. .tab_active {
  402. font-weight: 500;
  403. color: #222222;
  404. position: relative;
  405. }
  406. .tab_active::after {
  407. content: "";
  408. position: absolute;
  409. bottom: -14rpx;
  410. left: 15%;
  411. width: 50rpx;
  412. height: 6rpx;
  413. background: #506DFF;
  414. border-radius: 4rpx;
  415. }
  416. }
  417. }
  418. .box {
  419. width: 100%;
  420. box-sizing: border-box;
  421. padding: 0 30rpx;
  422. .box_item {
  423. background: #FFFFFF;
  424. border-radius: 20rpx;
  425. width: 100%;
  426. margin-top: 20rpx;
  427. box-sizing: border-box;
  428. padding: 0 20rpx;
  429. .cell {
  430. padding: 20rpx 0;
  431. }
  432. .title {
  433. font-size: 30rpx;
  434. font-weight: 500;
  435. color: #333333;
  436. line-height: 42rpx;
  437. }
  438. .text-blue {
  439. font-size: 26rpx;
  440. font-weight: 400;
  441. color: #506DFF;
  442. line-height: 36rpx;
  443. }
  444. .text-white {
  445. color: #333333;
  446. }
  447. .img {
  448. width: 160rpx;
  449. height: 160rpx;
  450. border-radius: 16rpx;
  451. }
  452. .img_right {
  453. margin-left: 16rpx;
  454. width: calc(100% - 176rpx);
  455. .name {
  456. width: 392rpx;
  457. font-size: 28rpx;
  458. font-weight: 500;
  459. color: #222222;
  460. line-height: 40rpx;
  461. }
  462. .norm {
  463. max-width: 300rpx;
  464. width: max-content;
  465. // height: 84rpx;
  466. background: #F5F5F5;
  467. border-radius: 4rpx;
  468. font-size: 22rpx;
  469. font-weight: 400;
  470. color: #888888;
  471. line-height: 32rpx;
  472. box-sizing: border-box;
  473. padding: 12rpx;
  474. // text-overflow: ellipsis;
  475. // overflow: hidden;
  476. // display: -webkit-box;
  477. // -webkit-box-orient: vertical;
  478. // box-orient: vertical;
  479. // line-clamp: 2;
  480. // -webkit-line-clamp: 2;
  481. }
  482. .num {
  483. font-size: 24rpx;
  484. font-weight: 500;
  485. color: #888888;
  486. line-height: 28rpx;
  487. }
  488. .text_red {
  489. font-size: 26rpx;
  490. font-weight: 400;
  491. color: #FF2626;
  492. line-height: 36rpx;
  493. padding-top: 18rpx;
  494. }
  495. }
  496. .scroll_img {
  497. position: relative;
  498. .imgs {
  499. width: 100%;
  500. height: 170rpx;
  501. overflow: hidden;
  502. white-space: nowrap;
  503. .imgs_item {
  504. width: 160rpx;
  505. height: 160rpx;
  506. border-radius: 16rpx;
  507. margin-right: 20rpx;
  508. display: inline-block;
  509. }
  510. }
  511. .img_leng {
  512. position: absolute;
  513. right: 0;
  514. top: 0;
  515. width: 130rpx;
  516. height: 160rpx;
  517. border-radius: 12rpx;
  518. font-size: 24rpx;
  519. font-weight: 500;
  520. color: #222222;
  521. line-height: 160rpx;
  522. text-align: center;
  523. background: linear-gradient(270deg, #FFFFFF 0%, rgba(255,255,255,0.78) 100%);
  524. }
  525. }
  526. .price {
  527. font-size: 30rpx;
  528. font-weight: 400;
  529. color: #222222;
  530. line-height: 24rpx;
  531. }
  532. .btn1 {
  533. width: 180rpx;
  534. height: 68rpx;
  535. border-radius: 36rpx;
  536. border: 1px solid #D0D0D0;
  537. text-align: center;
  538. font-size: 28rpx;
  539. font-weight: 400;
  540. color: #222222;
  541. line-height: 68rpx;
  542. }
  543. .btn2 {
  544. border: 1px solid #506DFF;
  545. color: #506DFF;
  546. margin-left: 32rpx;
  547. }
  548. }
  549. }
  550. .box:nth-last-child(1) {
  551. margin-bottom: 30rpx;
  552. }
  553. .popu {
  554. width: 100%;
  555. background: #FFFFFF;
  556. border-radius: 40rpx 40rpx 0px 0px;
  557. box-sizing: border-box;
  558. padding: 0 30rpx;
  559. .popu_title {
  560. width: 100%;
  561. text-align: center;
  562. padding: 48rpx 0 44rpx;
  563. font-size: 36rpx;
  564. font-weight: 500;
  565. color: #222222;
  566. line-height: 50rpx;
  567. }
  568. .popu_price {
  569. font-size: 36rpx;
  570. font-weight: 400;
  571. color: #FF2626;
  572. line-height: 44rpx;
  573. padding: 0 0 36rpx;
  574. }
  575. .type {
  576. font-size: 30rpx;
  577. font-weight: 400;
  578. color: #222222;
  579. line-height: 42rpx;
  580. }
  581. .way {
  582. width: 100%;
  583. margin: 28rpx 0 60rpx;
  584. background: #F4F4F4;
  585. border-radius: 12px;
  586. box-sizing: border-box;
  587. padding: 36rpx 20rpx;
  588. .pay_icon {
  589. width: 48rpx;
  590. height: 48rpx;
  591. margin-right: 20rpx;
  592. }
  593. }
  594. .btn_group {
  595. width: 100%;
  596. margin: 56rpx 0;
  597. .cancel_btn {
  598. width: 330rpx;
  599. height: 84rpx;
  600. background: #F4F6FF;
  601. border-radius: 42rpx;
  602. text-align: center;
  603. font-size: 32rpx;
  604. font-weight: 400;
  605. color: #506DFF;
  606. line-height: 84rpx;
  607. }
  608. .sure_btn {
  609. width: 330rpx;
  610. height: 84rpx;
  611. background: #506DFF;
  612. border-radius: 42rpx;
  613. text-align: center;
  614. font-size: 32rpx;
  615. font-weight: 400;
  616. color: #FFFFFF;
  617. line-height: 84rpx;
  618. }
  619. .sure_btn2 {
  620. width: 100%;
  621. height: 84rpx;
  622. background: #506DFF;
  623. border-radius: 42rpx;
  624. text-align: center;
  625. font-size: 32rpx;
  626. font-weight: 400;
  627. color: #FFFFFF;
  628. line-height: 84rpx;
  629. }
  630. }
  631. .u-radio-group {
  632. flex: unset;
  633. }
  634. }
  635. }
  636. </style>