mall-deal-list.html 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>列表-订单-创业帮</title>
  6. <meta name="keywords" content="列表-订单-创业帮">
  7. <meta name="description" content="列表-订单-创业帮">
  8. <meta content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,shrink-to-fit=no,user-scalable=no" name="viewport" viewport="cover">
  9. <meta name="apple-mobile-web-app-capable" content="yes">
  10. <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
  11. <meta content="telephone=no" name="format-detection">
  12. <meta content="email=no" name="format-detection">
  13. <meta name="apple-mobile-web-app-title" content="列表-订单-创业帮">
  14. <meta http-equiv="Cache-Control" content="no-siteapp">
  15. <link rel="stylesheet" href="./static/css/main.css">
  16. <style>
  17. .van-card__thumb .van-image{
  18. height:100%;
  19. width:100%;
  20. }
  21. </style>
  22. </head>
  23. <body class="bgcf7f7f7 pt0 ovh" style="padding-top:0;">
  24. <div id="app">
  25. <van-nav-bar class="user_rank_explan_title user_title_normal f16 rightbtn" title="我的订单" @click-left="goback" v-if="toptitleisshow" left-arrow v-cloak>
  26. <template #left> <img src="./static/images/icon-comback@2x.png" alt=""></template>
  27. </van-nav-bar>
  28. <div class="deal-list" v-cloak>
  29. <van-tabs v-model="active" animated line-width="20" line-height="2" @change="checktab" color="#FFD500" swipeable>
  30. <van-tab v-for="item,index in tabslist" :key="index" :title="item">
  31. <div class="ovh-x" style="height:calc(100vh - 44px);">
  32. <van-pull-refresh v-model="refreshing" @refresh="onRefresh" :class="products.length === 0 ? 'isnodata':''" style="height:100%;">
  33. <van-list v-model="loading" :finished="finished" finished-text="没有更多数据了" @load="onLoad" :immediate-check="false">
  34. <van-empty class="custom-image" image="./static/images/empty-img.png" description="暂无数据" v-if="isnodata"></van-empty>
  35. <van-cell-group class="bt8f7f7f7" v-for="item in products" :key="item.Id" :border="false" @click="godetail(item.Id)">
  36. <van-cell :title="item.CreateDate" :value="item.FinshStatus === 0 || item.FinshStatu === 0 ? '部分未付款' : item.Status" :class="item.Status !== '待付款' ? 'colorsp':''"></van-cell>
  37. <van-card class="suremall" v-for="obj,ind in item.Products" :price="obj.ProductPrice | tofixed2" :title="obj.ProductName" :num="obj.ProductCount" :key="ind" :lazy-load="true" centered>
  38. <template v-slot:thumb>
  39. <van-image :src="!obj.ProductPhoto ? './static/images/no-data.png' : showhost + '' +obj.ProductPhoto">
  40. <template v-slot:loading>
  41. <van-loading type="spinner" size="20"></van-loading>
  42. </template>
  43. </van-image>
  44. </template>
  45. <template #footer v-if="ind === item.Products.length - 1">
  46. <div class="tr van-hairline--top pt8 mt8"><span class="f12 c666">共{{item.BuyCount}}件商品 交易金额:</span><span class="f14 c333 more b">¥{{item.TotalPrice | tofixed2}}</span></div>
  47. <van-button class="mt8 border" plain hairline size="small" color="#ff502a" v-if="item.Status === '待付款' &amp;&amp; item.FinshStatus !== 0 &amp;&amp; item.FinshStatu !== 0" @click.stop="cancelOrder(item.Id)">取消订单</van-button>
  48. <van-button class="mt8 border" plain hairline size="small" color="#ff502a" v-if="item.Status === '待付款'">立即付款</van-button>
  49. </template>
  50. </van-card>
  51. </van-cell-group>
  52. </van-list>
  53. </van-pull-refresh>
  54. </div>
  55. </van-tab>
  56. </van-tabs>
  57. </div>
  58. <van-dialog style="border-radius:4px;" v-model="dialogisshow" title="确认取消订单?" confirm-button-color="#ff502a" show-cancel-button @confirm="cancleorderfn" @cancel="dialogisshow = false"> </van-dialog>
  59. </div>
  60. <script src="./static/js/klm-vv.min.js"></script>
  61. <script src="./static/js/appfunc.min.js"></script>
  62. <script src="./static/js/klm-axios-config.js"></script>
  63. <script src="./static/js/publicfn.js"></script>
  64. <script>
  65. // 通过 CDN 引入时不会自动注册 Lazyload 组件
  66. // 可以通过下面的方式手动注册
  67. Vue.use(vant.Lazyload);
  68. // 在 #app 标签下渲染一个按钮组件
  69. let app = new Vue({
  70. el: '#app',
  71. data() {
  72. return {
  73. dialogisshow:false,
  74. isnodata:false,
  75. toptitleisshow:false,
  76. active: 0,
  77. products:[
  78. ],
  79. loading: true,
  80. finished: false,
  81. refreshing: false,
  82. pageinfo:{
  83. PageSize:10,
  84. PageNum:1
  85. },
  86. tabslist:[
  87. '全部',
  88. '待付款',
  89. '已完成',
  90. ],
  91. showhost:'',
  92. orderid:'',
  93. };
  94. },
  95. created() {
  96. this.showhost = showHost;
  97. this.toptitleisshow = toptitleisshow;
  98. this.getdeallist('refresh');
  99. },
  100. methods: {
  101. cancelOrder(Id){
  102. this.dialogisshow = true;
  103. this.orderid = Id;
  104. },
  105. async cancleorderfn(){
  106. let that = this;
  107. const UserId = PublicLib.getCookieInfo('userId');
  108. const res = await getRequest('api/v1/orders/cancelorder?t='+Math.random(6),JSON.stringify({UserId,Id:this.orderid}));
  109. if(res.status !== '1') return tips('取消订单失败,请重试!');
  110. tips('取消订单成功!');
  111. this.products.forEach((item,index)=>{
  112. if(item.Id === that.orderid){
  113. this.products.splice(index,1);
  114. };
  115. });
  116. },
  117. onLoad() {
  118. if (this.refreshing) {
  119. this.products = [];
  120. this.refreshing = false;
  121. this.pageinfo.PageNum = 0;
  122. };
  123. this.pageinfo.PageNum++;
  124. this.getdeallist();
  125. },
  126. onRefresh() {
  127. // 清空列表数据
  128. this.finished = false;
  129. this.loading = true;
  130. // 重新加载数据
  131. this.pageinfo.PageNum = 1;
  132. if (this.refreshing) {
  133. this.refreshing = false;
  134. }
  135. this.getdeallist('refresh');
  136. //- this.onLoad();
  137. },
  138. async getdeallist(type='onload'){
  139. const ProductType = PublicLib.getCookieInfo('producttype') ? PublicLib.getCookieInfo('producttype') : "";
  140. PublicLib.putCookieInfo('producttype','');
  141. const UserId = PublicLib.getCookieInfo('userId');
  142. const res = await getRequest('api/v1/orders/list?t='+Math.random(6),JSON.stringify({...this.pageinfo,UserId,Status:this.active,ProductType}));
  143. if(res.status !== '1') return tips('获取商品列表失败,请重试!');
  144. if(res.data.length<this.pageinfo.PageSize) {
  145. this.finished = true;
  146. };
  147. res.data.forEach(item=>{
  148. //- item.FinshStatus = 0;
  149. })
  150. if(type==='refresh'){
  151. this.products = res.data
  152. this.refreshing = false;
  153. //- console.log('refresh',this.products)
  154. }
  155. if(type==='onload'){
  156. this.products.push(...res.data);
  157. //- console.log('onload',res.data)
  158. }
  159. this.loading = false;
  160. if(this.products.length === 0) {this.isnodata = true}else{this.isnodata = false};
  161. },
  162. goback(){
  163. PublicLib.GoBack({Level:1});
  164. },
  165. checktab(){
  166. //- this.products = [];
  167. this.getdeallist('refresh');
  168. },
  169. godetail(id){
  170. PublicLib.putCookieInfo('mallorderId', id);
  171. PublicLib.Goto({Url:'mall-deal-detail'});
  172. }
  173. }
  174. });
  175. </script>
  176. </body>
  177. </html>