index.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <template>
  2. <view :style="{ minHeight: sys.windowHeight + 'px' }"
  3. :class="[$tm.vx.state().tmVuetify.black ? 'black' : ' ']">
  4. <tm-menubars title="我的订单" :shadow="0" :showback="true"></tm-menubars>
  5. <tm-tabs align="split" class="qiehuan1" v-model="activeIndex" :list="list2" range-key="title" @change="changeTab"></tm-tabs>
  6. <div class="zhuti shangpin">
  7. <tm-sheet class="jiaoxi" style="" v-for="item in test">
  8. <tm-cartCellListFood class="shuliang" :typeclick="typeclick" :mdata="item" v-on:sure="goSure(item.id)" v-on:Eval="goEval(item.id)" :cart-num.sync="item.buy"></tm-cartCellListFood>
  9. </tm-sheet>
  10. </div>
  11. <view class="empty" v-if="isEmpty">
  12. 暂无内容~
  13. </view>
  14. <!-- 弹出层消息 -->
  15. <tm-message ref="toast"></tm-message>
  16. </view>
  17. </template>
  18. <script>
  19. import{myRequest} from '@/api/request.js'
  20. export default {
  21. data() {
  22. return {
  23. list2:[ '全部','待付款','已付款','已完成'],
  24. activeIndex:0,
  25. test: [
  26. {
  27. img: '../../static/img/83.png',
  28. title: '丝缎质感纹理风衣',
  29. label: '黑色 - 6518/320',
  30. size:'S',
  31. price: '1299',
  32. id: 3,
  33. buy: 0,
  34. itemId: 0,
  35. checked:false,
  36. status:0
  37. }],
  38. typeclick:4,//1加入购物车,2购物车
  39. page:1,
  40. pagesize:5,
  41. isBottom:false,
  42. isEmpty:false
  43. };
  44. },
  45. onLoad() {
  46. },
  47. created() {
  48. if(!uni.getStorageSync("token")){
  49. uni.navigateTo({
  50. url: "/pages/login/index",
  51. })
  52. }
  53. this.sys = uni.getSystemInfoSync();
  54. this.getOrderList(-1);
  55. },
  56. methods: {
  57. // 切换tab
  58. changeTab(e){
  59. this.activeIndex=e;
  60. let sel=0;
  61. if(e==0){
  62. sel=-1;
  63. }else if(e==1){
  64. sel=0;
  65. }else if(e==2){
  66. sel=1;
  67. }else if(e==3){
  68. sel=2;
  69. }
  70. this.getOrderList(sel)
  71. },
  72. // 获取订单列表
  73. getOrderList(index){
  74. let that=this;
  75. myRequest({
  76. url:'/api/Order/orderList',
  77. method:'post',
  78. data:{type:index,
  79. page:that.page,
  80. pagesize:that.pagesize}
  81. }).then(res=>{
  82. if (res.data.code == 200) {
  83. if (res.data.data.length != 0) {
  84. that.isEmpty=false;
  85. that.test = [];
  86. for (let i = 0; i < res.data.data.data.length; i++) {
  87. var obj = {
  88. img: res.data.data.data[i].orderGoods.goods_img,
  89. title: res.data.data.data[i].orderGoods.goods_name,
  90. // label: '黑色 - 6518/320',
  91. // size:'S',
  92. price: res.data.data.data[i].pay_money,
  93. id: res.data.data.data[i].id,
  94. buy: res.data.data.data[i].goods_num,
  95. itemId: res.data.data.data[i].id,
  96. checked: false,
  97. goods_id:res.data.data.data[i].goods_id,
  98. orderStatus:res.data.data.data[i].order_status,
  99. orderNo:res.data.data.data[i].order_sn,
  100. isEval:res.data.data.data[i].is_evaluate
  101. };
  102. that.test.push(obj)
  103. }
  104. }else {
  105. that.test = [];
  106. that.isEmpty=true;
  107. }
  108. }
  109. console.log(res.data.data.data,'订单列表');
  110. })
  111. },
  112. goSure(ids){
  113. let that=this;
  114. myRequest({
  115. url:'/api/Order/receipt',
  116. method:'post',
  117. data:{
  118. id:ids
  119. }
  120. }).then(res=>{
  121. if(res.data.code==200){
  122. that.$refs.toast.show({
  123. model: 'success',
  124. label: res.data.msg
  125. })
  126. }else{
  127. that.$refs.toast.show({
  128. model: 'error',
  129. label: res.data.msg
  130. })
  131. }
  132. })
  133. },
  134. goEval(ids){
  135. uni.navigateTo({
  136. url:'/pages/pingjia/index?id='+ids
  137. })
  138. }
  139. },
  140. }
  141. </script>
  142. <style lang="scss">
  143. /deep/ .tm-menubars .body{background-color: #1b1b1b !important;}
  144. /deep/ .qiehuan1 .text-primary{color: white !important;}
  145. /deep/ .qiehuan1 .tm-tabs-wk{border-top: 1px solid #262628;}
  146. /deep/ .shuliang .text-size-n{color: white !important;}
  147. /deep/ .shangpin .white.bk{background-color:#1b1b1b!important;}
  148. /deep/ .shangpin .tm-cartCellListFood{padding: 0px 0px 15px 0px !important;
  149. margin-top: 5px !important;margin-bottom: 20px !important;
  150. border-bottom: 1px solid #1B1B1B;}
  151. /deep/ .shangpin .border-t-1.bk{border-top:1px solid #1b1b1b!important;}
  152. /deep/ .shangpin .title{color: white !important;}
  153. /deep/ .shangpin .text-red{color: white !important;}
  154. /deep/ .shangpin .round-3{width:90px !important;height:90px !important;}
  155. /deep/ .shangpin .tm-cartCellListFood-img{width:90px !important;height:90px !important;}
  156. /deep/ .shuliang .text-size-n{color: white !important;}
  157. /deep/ .jiaoxi{margin:0 !important;padding: 8px !important;margin-top: 10px !important;}
  158. .empty{
  159. display: flex;justify-content:center;align-items: center;height: 100%;color: #AAAAAA;padding-top: 100px;
  160. }
  161. </style>