list.vue 16 KB

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