123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202 |
- ;
- var orderPage = new Vue({
- el: "#beansPage",
- data: {
- isRequset:true,
- noMore: false,
- tabsListIndex:0,
- tabsList: [
- {value: 0,text: '未使用'},
- {value: 1,text: '已使用'},
- {value: 2,text: '已失效'}
- ],
- listQuery:{
- userId:0,
- pageNum:1,
- pageSize:6,
- status:1
- },
- coupinList:[],
- listRecord: 0,
- pageInput: '1',
- userBeans:0,
- confirmedCount:'',//待確認數量
- paymentCount:'',//待付款
- waitShipmentsCount:'',//待发货
- shipmentsCount:'',//已发货
- salesReturnCount:'',//退货款
- modelType:0,
- orderIdentificationId:0,
- payModelData:{},
- hanldOrderData:{},//监听点击的单个订单项的按钮
- confrimsBtn:true,
- listClass:'used',
- dataList:[],
- },
- filters: {
- TypeBtnFormat:function(value){
- switch (value) {
- case 1:
- return '去使用';
- break;
- case 2:
- return '已使用';
- break;
- case 3:
- return '已失效';
- break;
- }
- },
- TypeFormat:function(value) {
- switch (value) {
- case 0:
- return '活动券';
- break;
- case 1:
- return '品类券';
- break;
- case 2:
- return '用户专享券';
- break;
- case 3:
- return '店铺券';
- break;
- case 4:
- return '新用户券';
- break;
- }
- }
- },
- computed: {
- pageTotal: function () {
- var total = Math.ceil(this.listRecord / this.listQuery.pageSize);
- return total > 0 ? total : 1;
- },
- showPageBtn: function () {
- var total = Math.ceil(this.listRecord / this.listQuery.pageSize);
- total = total > 0 ? total : 1;
- var index = this.listQuery.pageNum, arr = [];
- if (total <= 6) {
- for (var i = 1; i <= total; i++) {
- arr.push(i);
- }
- return arr;
- }
- if (index <= 3) return [1, 2, 3, 4, 5, 0, total];
- if (index >= total - 2) return [1, 0, total - 4, total - 3, total - 2, total - 1, total];
- return [1, 0, index - 2, index - 1, index, index + 1, index + 2, 0, total];
- }
- },
- methods: {
- tabClick:function(index){//点击Tab切换查询列表
- var _self = this;
- _self.tabsListIndex = index;
- console.log('tabsListIndex',_self.tabsListIndex)
- switch(_self.tabsListIndex){
- case 0:
- _self.listClass = 'used'
- _self.listQuery.status = 1
- break;
- case 1:
- _self.listClass = 'none'
- _self.listQuery.status = 2
- break;
- case 2:
- _self.listClass = 'none'
- _self.listQuery.status = 3
- break;
- }
- _self.listQuery.pageNum = 1;
- _self.QueryCouponCenter();
- },
- getQueryCouponsCount: function (){// 获取优惠券数量
- var _self = this;
- ProductApi.QueryCouponsCount({userId:this.listQuery.userId,},function (response) {
- if(response.code == 0){
- let data = response.data
- _self.tabsList[0].num = data.unusedNum
- _self.tabsList[1].num = data.usedNum
- _self.tabsList[2].num = data.expiredNum
- }else{
- CAIMEI.Alert(response.msg, '确定', false);
- }
- })
- },
- toPagination: function (pageNum) {//点击切换分页
- if (pageNum <= this.pageTotal) {
- this.listQuery.pageNum = pageNum;
- this.QueryCouponCenter();
- }
- },
- checkNum: function () {//输入跳转分页
- if (this.pageInput > this.pageTotal) {
- this.pageInput = this.pageTotal;
- } else if (this.pageInput < 1) {
- this.pageInput = 1;
- }
- },
- QueryCouponCenter:function(){//查询订单列表
- var _self = this;
- ProductApi.QueryCouponCenter(_self.listQuery,function (response) {
- if(response.code == 0){
- var data = response.data;
- if( data.list && data.list.length>0) {
- _self.coupinList = [];
- _self.coupinList = data.list;
- _self.listRecord = data.total;
- }else{
- _self.coupinList = [];
- _self.coupinList = data.list;
- _self.listRecord = data.total;
- }
- _self.isRequset = false;
- }else{
- CAIMEI.Alert(response.msg, '确定', false);
- }
- })
- },
- toUseCoupon:function(coupon){// 点击去使用跳转路由处理
- console.log(coupon)
- if(coupon.useStatus == 1){
- switch (coupon.couponType) {
- case 0:// 活动券跳转到商城首页 / 或者活动页(看是否指定了商品)
- if(coupon.productType == 1){
- window.location.href='/index.html';
- }else{
- window.location.href='/product/product-coupon.html?couponId='+coupon.couponId;
- }
- break;
- case 1:// 品类券:跳转到产品 / 仪器页
- if(coupon.categoryType == 1){
- window.location.href='/product/type-287.html';
- }else{
- window.location.href='/product/type-286.html';
- }
- break;
- case 2:// 专享券:跳转到商城首页
- window.location.href='/index.html';
- break;
- case 3:// 店铺券:跳转到店铺首页
- console.log('22222222222')
- window.location.href='/supplier-'+coupon.shopId+'.html';
- debugger
- break;
- case 4:// 新用户券:跳转到商城首页
- window.location.href='/index.html';
- break;
- }
- }else{
- return;
- }
- },
- },
- mounted: function () {
- var _self = this;
- if(globalUserData){
- _self.userId = globalUserData.userId;
- _self.listQuery.userId = this.userId;
- _self.getQueryCouponsCount();
- _self.QueryCouponCenter();
- }
- }
- });
|