OrderList.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489
  1. <template><page-meta :root-font-size="fontSize+'px'"></page-meta>
  2. <member-base :show="false"><view style="position: absolute;top:0;right:0;left:0;bottom:0" class="scroll-view-wrapper div member-order-list">
  3. <view class="div common-header-wrap">
  4. <view class="status-holder"></view>
  5. <view :style="'height:'+navHeight+'px'"></view>
  6. <view class="common-header-holder"></view>
  7. <view class="common-header-fixed">
  8. <title-header />
  9. <view class="common-header">
  10. <view class="div slot" >
  11. <view class="div" style="text-align: left"><text class="span iconfont" @click="goBack()">&#xe67f;</text></view>
  12. </view>
  13. <view class="common-search">
  14. <input type="text" v-model="keyword" placeholder="请输入您要搜索的订单商品名称" @click="goOrderSearch()">
  15. </view>
  16. </view>
  17. </view>
  18. </view>
  19. <!-- header -->
  20. <view class="div order-header">
  21. <view class="ul">
  22. <view
  23. class="li item"
  24. v-for="item in orderNav"
  25. v-bind:key="item.id"
  26. v-bind:class="{ active: stateType == item.id }"
  27. v-on:click="setOrderNavActive(item.id)"
  28. >
  29. {{ item.name }}
  30. </view>
  31. </view>
  32. </view>
  33. <view class="scroll-view div" style="position:relative">
  34. <scroll-view style="position: absolute;top:0;right:0;left:0;bottom:0" class="div" @scrolltolower="loadMore" scroll-y="true">
  35. <view class="div order-body" v-if="order_group_list && order_group_list.length">
  36. <view class="div" v-for="(order_group, index) in order_group_list" v-bind:key="index">
  37. <view class="div list" v-for="item in order_group.order_list" :key="item.order_id">
  38. <navigator :url="'/pages/member/order/OrderDetail?order_id='+item.order_id">
  39. <view class="div tips-body">
  40. <text class="span tips"> 订单编号: {{ item.order_sn }} </text>
  41. <text class="span title tips statusTips" >{{ item.state_desc }}</text>
  42. </view>
  43. <view class="div order-image multiple" v-if="item.extend_order_goods.length > 1">
  44. <view class="div imagebox">
  45. <image mode="aspectFit" class="img" v-for="(image,index) in item.extend_order_goods" :key="index" v-bind:src="image.goods_image_url" />
  46. </view>
  47. </view>
  48. <view class="div order-image" v-else-if="item.extend_order_goods.length == 1" >
  49. <view class="div goods_info clearfix" v-for="(image,index) in item.extend_order_goods" :key="index" >
  50. <view class="div img-wrapper">
  51. <image mode="aspectFit" class="img" v-bind:src="image.goods_image_url" />
  52. </view>
  53. <view class="p goods_name">{{image.goods_name}}</view>
  54. <view class="p goods_price">
  55. <view class="price">¥{{image.goods_price}}</view>
  56. <view class="num">X{{image.goods_num}}</view>
  57. </view>
  58. </view>
  59. </view>
  60. <view class="div order-image" v-if="item.zengpin_list" >
  61. <view class="div goods_info clearfix" v-for="(image,index) in item.zengpin_list" :key="index" >
  62. <view class="div img-wrapper">
  63. <image mode="aspectFit" class="img" v-bind:src="image.image_url" />
  64. </view>
  65. <view class="p goods_name"><text class="span tag-icon">赠品</text>{{image.goods_name}}</view>
  66. <view class="p goods_price">
  67. <view class="price">¥{{image.goods_price}}</view>
  68. <view class="num">X{{image.goods_num}}</view>
  69. </view>
  70. </view>
  71. </view>
  72. <view class="div order_amount">
  73. (共计{{ item.extend_order_goods.length }}种商品) 合计 : <text class="order_amount_icon">¥</text><text class="i">{{ item.order_amount }}</text><text class="i freight">(运费:¥{{ item.shipping_fee }})</text>
  74. </view>
  75. </navigator>
  76. <view class="div order-list-opratio">
  77. <!-- 锁定-->
  78. <text class="button" v-if="item.if_lock && item.extend_refund" v-on:click="goRefund(item.extend_refund.refund_id)">退款中</text>
  79. <!-- 取消订单 -->
  80. <text class="button" v-if="item.if_cancel" v-on:click="cancel(item)">取消订单</text>
  81. <!-- 退款取消订单 -->
  82. <text v-if="item.if_refund_cancel" v-on:click="refund(item.order_id)" class="button line_red">退款</text>
  83. <!-- 物流跟踪 -->
  84. <text class="button" v-if="item.if_deliver" v-on:click="deliver(item.order_id)">物流跟踪</text>
  85. <!-- 收货 -->
  86. <text class="button" v-if="item.if_receive" v-on:click="receive(item.order_id)">收货</text>
  87. <!-- 评价 -->
  88. <text class="button" v-if="item.if_evaluation" v-on:click="evaluate(item.order_id)">评价</text>
  89. <!-- 删除 -->
  90. <text class="button" v-if="item.if_delete" v-on:click="deleteOrder(item)">删除</text>
  91. </view>
  92. </view>
  93. <!-- 独立按钮 涉及多个店铺合并 付款 -->
  94. <view v-if="order_group.pay_amount && order_group.pay_amount>0" class="div common-btn ds-button-large mt-5 mb-5" @click="pay(order_group.pay_sn)">付款</view>
  95. </view>
  96. </view>
  97. <empty-record v-else-if="order_group_list && !order_group_list.length"></empty-record>
  98. </scroll-view>
  99. </view>
  100. </view>
  101. <uni-popup background-color="#fff" ref="confirm" type="dialog">
  102. <uni-popup-dialog :mode="dialog.mode" :title="dialog.title" :content="dialog.content" :placeholder="dialog.content" @confirm="confirmDialog" @close="closeDialog"></uni-popup-dialog>
  103. </uni-popup>
  104. </member-base>
  105. </template>
  106. <script>
  107. import {getFontSize} from '@/util/common'
  108. import TitleHeader from '../../TitleHeader'
  109. import { urlencode } from '@/util/common'
  110. import MemberBase from '../MemberBase'
  111. import { getOrderList, cancelOrder, receiveOrder, deleteOrder } from '../../../api/memberOrder'
  112. import { mapState } from 'vuex'
  113. import EmptyRecord from '../../EmptyRecord'
  114. export default {
  115. components:{
  116. TitleHeader,
  117. MemberBase,
  118. EmptyRecord
  119. },
  120. name:'MemberOrderList',
  121. data(){
  122. return {
  123. if_pay:0,
  124. navHeight: 0,
  125. dialog:{},
  126. order_id: 0,
  127. orderNav: [
  128. {
  129. 'name': '全部',
  130. 'id': ''
  131. },
  132. {
  133. 'name': '待付款',
  134. 'id': 'state_new'
  135. },
  136. {
  137. 'name': '待发货',
  138. 'id': 'state_pay'
  139. },
  140. {
  141. 'name': '待收货',
  142. 'id': 'state_send'
  143. },
  144. {
  145. 'name': '待评价',
  146. 'id': 'state_noeval'
  147. }
  148. ],
  149. stateType: '',
  150. orderDetailVisible: false,
  151. wrapperHeight: 0,
  152. params: { 'page': 0, 'per_page': 10 },
  153. loading: false, // 是否加载更多
  154. isMore: true, // 是否有更多
  155. order_group_list: false
  156. }
  157. },
  158. mounted(){
  159. // #ifdef MP-WEIXIN
  160. this.navHeight = uni.getMenuButtonBoundingClientRect().top
  161. // #endif
  162. this.wrapperHeight = uni.getSystemInfoSync().windowHeight - 180
  163. },
  164. computed:{
  165. fontSize(){
  166. return getFontSize()
  167. },
  168. ...mapState({
  169. user: state => state.member.info
  170. })
  171. },
  172. onLoad: function (option) {
  173. this.if_pay=option.if_pay
  174. this.stateType=option.state ? option.state : ''
  175. this.keyword=option.keyword ? option.keyword : ''
  176. },
  177. onShow(){
  178. this.reload()
  179. },
  180. methods:{
  181. closeDialog(){
  182. },
  183. confirmDialog(value){
  184. switch(this.dialog.condition){
  185. case 1:
  186. deleteOrder(this.dialog.data.order_id).then(res => {
  187. this.getOrderList(true)
  188. }).catch(function (error) {
  189. uni.showToast({icon:'none',title: error.message})
  190. })
  191. break
  192. case 2:
  193. cancelOrder(this.dialog.data.order_id).then(res => {
  194. this.getOrderList(true)
  195. }).catch(function (error) {
  196. uni.showToast({icon:'none',title: error.message})
  197. })
  198. break
  199. case 3:
  200. receiveOrder(this.dialog.data).then(res => {
  201. this.getOrderList(true)
  202. }).catch(function (error) {
  203. uni.showToast({icon:'none',title: error.message})
  204. })
  205. break
  206. }
  207. },
  208. goOrderSearch () {
  209. uni.navigateTo({ url: '/pages/member/order/OrderSearch'})
  210. },
  211. goBack(){
  212. if(this.if_pay){
  213. uni.reLaunch({
  214. url:'/pages/member/index/Index'
  215. })
  216. }else{
  217. uni.navigateBack({delta:1})
  218. }
  219. },
  220. setOrderNavActive (index) {
  221. this.stateType = index
  222. this.getOrderList(true)
  223. },
  224. deleteOrder (orderInfo) {
  225. this.dialog={condition:1,content:'确定要删除该订单吗?',data:orderInfo}
  226. this.$refs.confirm.open()
  227. },
  228. cancel (orderInfo) {
  229. this.dialog={condition:2,content:'确定要取消该订单吗?',data:orderInfo}
  230. this.$refs.confirm.open()
  231. },
  232. receive (orderId) {
  233. this.dialog={condition:3,content:'确定该订单已收货吗?',data:orderId}
  234. this.$refs.confirm.open()
  235. },
  236. deliver (orderId) {
  237. uni.navigateTo({ url: '/pages/member/order/OrderDeliver'+'?'+urlencode( { order_id: orderId } )})
  238. },
  239. goRefund(refundId){
  240. uni.navigateTo({ url: '/pages/member/refund/RefundView'+'?'+urlencode( { refund_id: refundId } )})
  241. },
  242. refund (orderId) {
  243. uni.navigateTo({ url: '/pages/member/refund/RefundForm'+'?'+urlencode( { order_id: orderId } )})
  244. },
  245. evaluate (orderId) {
  246. uni.navigateTo({ url: '/pages/member/order/OrderEvaluate'+'?'+urlencode( { order_id: orderId } )})
  247. },
  248. pay (paySn) {
  249. uni.navigateTo({ url: '/pages/member/buy/pay'+'?'+urlencode( { pay_sn: paySn, pay_type: 'pay_new' } )})
  250. },
  251. getOrderInfo (orderId) {
  252. this.orderDetailVisible = true
  253. this.order_id = orderId
  254. },
  255. loadMore () {
  256. this.loading = true
  257. this.params.page = ++this.params.page
  258. if (this.isMore) {
  259. this.loading = false
  260. this.getOrderList(false)
  261. }
  262. },
  263. reload () {
  264. // 重新加载数据
  265. this.params.page = 0
  266. this.isMore = true
  267. this.order_group_list = false
  268. this.loadMore()
  269. },
  270. getOrderList (ifReplace) {
  271. uni.showLoading({ title: '加载中' })
  272. if (ifReplace) {
  273. this.loading = false
  274. this.params.page = 1
  275. this.isMore = true
  276. }
  277. getOrderList(this.params, this.stateType, '',this.keyword).then(res => {
  278. uni.hideLoading()
  279. if (res.result.hasmore) {
  280. this.isMore = true
  281. } else {
  282. this.isMore = false
  283. }
  284. let tOrderGroup = res.result.order_group_list
  285. if (tOrderGroup) {
  286. if (ifReplace || !this.order_group_list) {
  287. this.order_group_list = tOrderGroup
  288. } else {
  289. this.order_group_list = this.order_group_list.concat(tOrderGroup)
  290. }
  291. }
  292. }).catch(function (error) {
  293. uni.hideLoading()
  294. uni.showToast({icon:'none',title: error.message})
  295. })
  296. }
  297. }
  298. }
  299. </script>
  300. <style lang="scss" scoped>
  301. .scroll-view-wrapper{display: flex;flex-direction: column;}
  302. .scroll-view{flex:1}
  303. .member-order-list {
  304. .common-header{display: flex;height: 2rem;padding: 0.25rem .6rem;justify-content: space-between;align-items: center;box-shadow: 0px 4px 4px #f7f7f7;box-sizing: border-box;}
  305. .slot{width:2.5rem;height: 1.6rem;text-align:center;line-height:1.6rem;font-size: .8rem;}
  306. .common-search{
  307. padding:0;
  308. padding-left: $pageSpace;
  309. padding-right: $pageSpace;
  310. flex:1;
  311. input {
  312. box-sizing: border-box;
  313. width: 100%;
  314. height: 1.6rem;
  315. border-radius: 1.6rem;
  316. background: #F4F4F4 url(../../../static/image/home/icon_search.png) no-repeat 0.6rem center;
  317. background-size:0.55rem;
  318. font-size:$fontSize;
  319. color: #999;
  320. padding-left:1.6rem;
  321. border: 0;
  322. }
  323. }
  324. .order-header {
  325. height: 2.2rem;
  326. .ul {
  327. list-style: none;
  328. width: auto;
  329. display: flex;
  330. justify-content: space-around;
  331. align-content: center;
  332. align-items: center;
  333. height: 100%;
  334. background: rgba(255, 255, 255, 1);
  335. border-bottom: 1px solid #e8eaed;
  336. .li {
  337. font-size:$subFontSize;
  338. color: #333;
  339. height: 100%;
  340. text-align: center;
  341. line-height: 2.2rem;
  342. border-bottom: 0.1rem solid transparent;
  343. &.active {
  344. color: $primaryColor;
  345. border-bottom-color: $primaryColor;
  346. }
  347. }
  348. }
  349. }
  350. .order-body {
  351. position:relative;
  352. .list {
  353. width: 100%;
  354. margin-top:0.5rem;
  355. .tips-body {
  356. height: 2.2rem;
  357. background: rgba(255, 255, 255, 1);
  358. box-shadow: 0 0.5px 0 0 rgba(232, 234, 237, 1);
  359. display: flex;
  360. justify-content: space-between;
  361. padding: 0 0.75rem 0 0.5rem;
  362. .tips {
  363. font-size:$subFontSize;
  364. color: #333;
  365. line-height: 2.2rem;
  366. }
  367. .statusTips {
  368. color: $primaryColor;
  369. }
  370. .img {
  371. width: 3.8rem;
  372. height: 3rem;
  373. }
  374. }
  375. .order-image {
  376. height: 4.55rem;
  377. background: rgba(250, 250, 250, 1);
  378. width: 100%;
  379. overflow:hidden;
  380. overflow-x: auto;
  381. white-space: nowrap;
  382. .goods_info{
  383. height:4rem;
  384. margin-bottom: .5rem;
  385. display: flex;
  386. align-items: center;
  387. padding-right: $pageSpace;
  388. .img-wrapper{
  389. width: 3rem;
  390. height: 3rem;
  391. margin: .85rem .6rem .5rem .3rem;
  392. .img{
  393. width: 3rem;
  394. height: 3rem;
  395. border-radius: 1px;
  396. }
  397. }
  398. .goods_name{
  399. white-space: normal;
  400. overflow: hidden;
  401. height: 2rem;
  402. width: 10rem;
  403. font-size: .7rem;
  404. }
  405. .goods_price{
  406. margin-left: auto;
  407. padding-right: .75rem;
  408. text-align: right;
  409. .price{
  410. font-size:$subFontSize;
  411. color: rgba(78, 84, 93, 1);
  412. }
  413. .num{
  414. font-size: .6rem;
  415. color: #999;
  416. padding-top: .3rem;
  417. }
  418. }
  419. }
  420. }
  421. .multiple{
  422. .imagebox{
  423. width: 100%;
  424. overflow-x: auto;
  425. white-space: nowrap;
  426. .img{
  427. width: 3rem;
  428. height:3rem;
  429. margin: .85rem .3rem .5rem;
  430. display: inline-block;
  431. }
  432. }
  433. }
  434. .order_amount {
  435. font-size:$subFontSize;
  436. color: rgba(78, 84, 93, 1);
  437. line-height: 2.2rem;
  438. height: 2.2rem;
  439. background-color: #fff;
  440. padding: 0 0.75rem 0 0;
  441. border-bottom: 1px solid #e8eaed;
  442. box-sizing: border-box;
  443. text-align: right;
  444. overflow: hidden;
  445. text-overflow: ellipsis;
  446. white-space: nowrap;
  447. .order_amount_icon{
  448. font-size:$subFontSize;
  449. color: $primaryColor;
  450. }
  451. .i {
  452. font-size:$h2;
  453. color:$primaryColor;
  454. padding-left:0.15rem;
  455. font-style: normal;
  456. &.freight {
  457. color: #333;
  458. font-size:$fontSize;
  459. }
  460. }
  461. }
  462. }
  463. .loading-wrapper {
  464. text-align: center;
  465. .p {
  466. color: #c3c3c3;
  467. font-size:$fontSize;
  468. margin: 0.5rem auto;
  469. }
  470. }
  471. }
  472. .mint-popup {
  473. width: 100%;
  474. height: 11.75rem;
  475. }
  476. }
  477. .order-list-opratio{height: 2.2rem;display: flex;justify-content: flex-end;background: rgba(255, 255, 255, 1);border-radius: 0.1rem;}
  478. .order-list-opratio .button{width: 4.5rem;height: 1.5rem;font-size:$subFontSize;border-radius: 0.7rem;margin: 0.35rem 0.75rem 0.35rem 0;background-color: #fff;border: 1px solid #ccc;box-shadow: 0 3px 6px 0 rgba(0,0,0,.05);display:flex;align-items:center;justify-content:center;}
  479. .order-list-opratio .line_red{background-color: #fff;color: #f2270c;border: 1px solid #f2270c;box-shadow: 0 3px 6px 0 rgba(242,39,12,.1);}
  480. .ds-button-large{margin:0 $pageSpace;}
  481. </style>