123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>列表-订单-创业帮</title>
- <meta name="keywords" content="列表-订单-创业帮">
- <meta name="description" content="列表-订单-创业帮">
- <meta content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,shrink-to-fit=no,user-scalable=no" name="viewport" viewport="cover">
- <meta name="apple-mobile-web-app-capable" content="yes">
- <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
- <meta content="telephone=no" name="format-detection">
- <meta content="email=no" name="format-detection">
- <meta name="apple-mobile-web-app-title" content="列表-订单-创业帮">
- <meta http-equiv="Cache-Control" content="no-siteapp">
- <link rel="stylesheet" href="./static/css/main.css">
- <style>
- .van-card__thumb .van-image{
- height:100%;
- width:100%;
- }
- </style>
- </head>
- <body class="bgcf7f7f7 pt0 ovh" style="padding-top:0;">
- <div id="app">
- <van-nav-bar class="user_rank_explan_title user_title_normal f16 rightbtn" title="我的订单" @click-left="goback" v-if="toptitleisshow" left-arrow v-cloak>
- <template #left> <img src="./static/images/icon-comback@2x.png" alt=""></template>
- </van-nav-bar>
- <div class="deal-list" v-cloak>
- <van-tabs v-model="active" animated line-width="20" line-height="2" @change="checktab" color="#FFD500" swipeable>
- <van-tab v-for="item,index in tabslist" :key="index" :title="item">
- <div class="ovh-x" style="height:calc(100vh - 44px);">
- <van-pull-refresh v-model="refreshing" @refresh="onRefresh" :class="products.length === 0 ? 'isnodata':''" style="height:100%;">
- <van-list v-model="loading" :finished="finished" finished-text="没有更多数据了" @load="onLoad" :immediate-check="false">
- <van-empty class="custom-image" image="./static/images/empty-img.png" description="暂无数据" v-if="isnodata"></van-empty>
- <van-cell-group class="bt8f7f7f7" v-for="item in products" :key="item.Id" :border="false" @click="godetail(item.Id)">
- <van-cell :title="item.CreateDate" :value="item.FinshStatus === 0 || item.FinshStatu === 0 ? '部分未付款' : item.Status" :class="item.Status !== '待付款' ? 'colorsp':''"></van-cell>
- <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>
- <template v-slot:thumb>
- <van-image :src="!obj.ProductPhoto ? './static/images/no-data.png' : showhost + '' +obj.ProductPhoto">
- <template v-slot:loading>
- <van-loading type="spinner" size="20"></van-loading>
- </template>
- </van-image>
- </template>
- <template #footer v-if="ind === item.Products.length - 1">
- <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>
- <van-button class="mt8 border" plain hairline size="small" color="#ff502a" v-if="item.Status === '待付款' && item.FinshStatus !== 0 && item.FinshStatu !== 0" @click.stop="cancelOrder(item.Id)">取消订单</van-button>
- <van-button class="mt8 border" plain hairline size="small" color="#ff502a" v-if="item.Status === '待付款'">立即付款</van-button>
- </template>
- </van-card>
- </van-cell-group>
- </van-list>
- </van-pull-refresh>
- </div>
- </van-tab>
- </van-tabs>
- </div>
- <van-dialog style="border-radius:4px;" v-model="dialogisshow" title="确认取消订单?" confirm-button-color="#ff502a" show-cancel-button @confirm="cancleorderfn" @cancel="dialogisshow = false"> </van-dialog>
- </div>
- <script src="./static/js/klm-vv.min.js"></script>
- <script src="./static/js/appfunc.min.js"></script>
- <script src="./static/js/klm-axios-config.js"></script>
- <script src="./static/js/publicfn.js"></script>
- <script>
- // 通过 CDN 引入时不会自动注册 Lazyload 组件
- // 可以通过下面的方式手动注册
- Vue.use(vant.Lazyload);
-
- // 在 #app 标签下渲染一个按钮组件
- let app = new Vue({
- el: '#app',
- data() {
- return {
- dialogisshow:false,
- isnodata:false,
- toptitleisshow:false,
- active: 0,
- products:[
- ],
- loading: true,
- finished: false,
- refreshing: false,
- pageinfo:{
- PageSize:10,
- PageNum:1
- },
- tabslist:[
- '全部',
- '待付款',
- '已完成',
- ],
- showhost:'',
- orderid:'',
- };
- },
- created() {
- this.showhost = showHost;
- this.toptitleisshow = toptitleisshow;
- this.getdeallist('refresh');
- },
- methods: {
- cancelOrder(Id){
- this.dialogisshow = true;
- this.orderid = Id;
- },
- async cancleorderfn(){
- let that = this;
- const UserId = PublicLib.getCookieInfo('userId');
- const res = await getRequest('api/v1/orders/cancelorder?t='+Math.random(6),JSON.stringify({UserId,Id:this.orderid}));
- if(res.status !== '1') return tips('取消订单失败,请重试!');
- tips('取消订单成功!');
- this.products.forEach((item,index)=>{
- if(item.Id === that.orderid){
- this.products.splice(index,1);
- };
- });
- },
- onLoad() {
- if (this.refreshing) {
- this.products = [];
- this.refreshing = false;
- this.pageinfo.PageNum = 0;
- };
- this.pageinfo.PageNum++;
- this.getdeallist();
- },
- onRefresh() {
- // 清空列表数据
- this.finished = false;
- this.loading = true;
- // 重新加载数据
- this.pageinfo.PageNum = 1;
- if (this.refreshing) {
- this.refreshing = false;
- }
- this.getdeallist('refresh');
- //- this.onLoad();
- },
- async getdeallist(type='onload'){
- const ProductType = PublicLib.getCookieInfo('producttype') ? PublicLib.getCookieInfo('producttype') : "";
- PublicLib.putCookieInfo('producttype','');
- const UserId = PublicLib.getCookieInfo('userId');
- const res = await getRequest('api/v1/orders/list?t='+Math.random(6),JSON.stringify({...this.pageinfo,UserId,Status:this.active,ProductType}));
- if(res.status !== '1') return tips('获取商品列表失败,请重试!');
- if(res.data.length<this.pageinfo.PageSize) {
- this.finished = true;
- };
- res.data.forEach(item=>{
- //- item.FinshStatus = 0;
- })
- if(type==='refresh'){
- this.products = res.data
- this.refreshing = false;
- //- console.log('refresh',this.products)
- }
- if(type==='onload'){
- this.products.push(...res.data);
- //- console.log('onload',res.data)
- }
- this.loading = false;
- if(this.products.length === 0) {this.isnodata = true}else{this.isnodata = false};
- },
- goback(){
- PublicLib.GoBack({Level:1});
- },
- checktab(){
- //- this.products = [];
- this.getdeallist('refresh');
- },
- godetail(id){
- PublicLib.putCookieInfo('mallorderId', id);
- PublicLib.Goto({Url:'mall-deal-detail'});
- }
- }
- });
- </script>
- </body>
- </html>
|