Browse Source

2023-3-8

完善功能
master
guoxing 2 years ago
parent
commit
419533df1f
  1. 23
      mallplusui-uniapp-app/common/api.js
  2. 2
      mallplusui-uniapp-app/components/eonfox/eonfox.js
  3. 464
      mallplusui-uniapp-app/components/eonfox/fns.js
  4. 116
      mallplusui-uniapp-app/pages/order/orderDetail.vue
  5. 329
      mallplusui-uniapp-app/pagesU/user/coupon.vue
  6. 824
      mallplusui-uniapp-app/pagesU/user/deposit.vue

23
mallplusui-uniapp-app/common/api.js

@ -1,7 +1,7 @@
import store from '../store/index'; import store from '../store/index';
export default { export default {
// qq 237524947 wx15d4269d3210863d // qq 237524947 wx15d4269d3210863d
// BASEURI: 'http://5rygzr.natappfree.cc/api/', // BASEURI: 'http://br68s5.natappfree.cc/api/',
BASEURI: 'http://mall.yyundong.com/portalapi/api/', BASEURI: 'http://mall.yyundong.com/portalapi/api/',
// BASEURI: 'http://192.168.31.52:8083/api/', // BASEURI: 'http://192.168.31.52:8083/api/',
ADMINURI: 'http://mall.yyundong.com/adminapi/', ADMINURI: 'http://mall.yyundong.com/adminapi/',
@ -78,8 +78,8 @@ export default {
memberTagList: 'single/user/memberTag/list', // 商户列表 memberTagList: 'single/user/memberTag/list', // 商户列表
addStoreComment: 'single/store/addStoreComment', // 商户addStoreComment addStoreComment: 'single/store/addStoreComment', // 商户addStoreComment
memberBlanceLogList: 'single/user/memberBlanceLog/list', memberBlanceLogList: 'single/user/memberBlanceLog/list',
mesList: 'sys/message/list',// GET 参数为空,获取用户消息通知列表,(需要先判断用户是已经登录状态) mesList: 'sys/message/list', // GET 参数为空,获取用户消息通知列表,(需要先判断用户是已经登录状态)
mesInfo: 'sys/message/info',// GET 参数为 id:消息ID,获取消息详情 mesInfo: 'sys/message/info', // GET 参数为 id:消息ID,获取消息详情
}, },
build: { build: {
getBuildNoticeByPage: 'single/build/getBuildNoticeByPage', // 所有社区和房间 getBuildNoticeByPage: 'single/build/getBuildNoticeByPage', // 所有社区和房间
@ -262,7 +262,7 @@ export default {
let token = uni.getStorageSync('token') || ''; let token = uni.getStorageSync('token') || '';
let fullurl = this.BASEURI + endpoint; let fullurl = this.BASEURI + endpoint;
console.log("fullurl",fullurl); console.log("fullurl", fullurl);
var contentType = 'application/x-www-form-urlencoded'; var contentType = 'application/x-www-form-urlencoded';
data.authorization = token; data.authorization = token;
@ -281,11 +281,18 @@ export default {
uni.hideLoading(); uni.hideLoading();
} }
console.log('error', error);
console.log('res', res);
if (undefined == res || 'undefined' == res) { if (undefined == res || 'undefined' == res) {
console.log('index'); console.log('index');
uni.navigateTo({ uni.showToast({
url: `/pages/public/login` title: '网络错误',
}) icon: 'none'
});
return;
// uni.navigateTo({
// url: `/pages/public/login`
// })
} }
if (res.data.msg == 'User token expired!') { if (res.data.msg == 'User token expired!') {
console.log('User token expired'); console.log('User token expired');
@ -315,7 +322,7 @@ export default {
return res.data.data; return res.data.data;
} else { } else {
console.log(">>>>>="); console.log(">>>>>=");
console.log(">>>>>=",res.data); console.log(">>>>>=", res.data);
if (res.data) { if (res.data) {
if (!res.data.msg) { if (!res.data.msg) {
res.data.msg = res.data.data; res.data.msg = res.data.data;

2
mallplusui-uniapp-app/components/eonfox/eonfox.js

@ -25,7 +25,7 @@ eonfox.prototype = {
//接口地址 应用ID //接口地址 应用ID
api_server_url : 'http://server.test.eapie.com/', api_server_url : 'http://server.test.eapie.com/',
application : "test", application : "wxa66597d50184d027",
//会话名称 //会话名称
session_name : 'Eonfox_API_Engine_Session', session_name : 'Eonfox_API_Engine_Session',

464
mallplusui-uniapp-app/components/eonfox/fns.js

@ -1,55 +1,54 @@
var fns = { var fns = {
//-------------- //--------------
//api接口验证 //api接口验证
checkError: function(data, ids, error){ checkError: function(data, ids, error) {
if(typeof(error)!='function'){ if (typeof(error) != 'function') {
error=function(){ error = function() {}
}
} }
if(data.errno){ if (data.errno) {
error(data.errno, data.error); error(data.errno, data.error);
return false; return false;
} }
if(!data.data){ if (!data.data) {
error(1, "未知错误"); error(1, "未知错误");
return false; return false;
} }
if(ids){ if (ids) {
if(typeof ids =='object'){ if (typeof ids == 'object') {
for( var i in ids){ for (var i in ids) {
if(typeof ids[i] != "undefined"){ if (typeof ids[i] != "undefined") {
var id = ids[i]; var id = ids[i];
if( data.data[id] && data.data[id].errno ){ if (data.data[id] && data.data[id].errno) {
error(data.data[id].errno, data.data[id].error); error(data.data[id].errno, data.data[id].error);
return false; return false;
} }
}else{ } else {
error(1, "“"+ids[i]+"”目标,未知错误"); error(1, "“" + ids[i] + "”目标,未知错误");
return false; return false;
} }
} }
}else if(typeof ids =='string' || typeof ids == 'number'){ } else if (typeof ids == 'string' || typeof ids == 'number') {
if(typeof data.data[ids] != "undefined" ){ if (typeof data.data[ids] != "undefined") {
if( data.data[ids].errno ){ if (data.data[ids].errno) {
error(data.data[ids].errno, data.data[ids].error); error(data.data[ids].errno, data.data[ids].error);
return false; return false;
} }
}else{ } else {
error(1, "“"+ids+"”目标,未知错误"); error(1, "“" + ids + "”目标,未知错误");
return false; return false;
} }
}else{ } else {
error(1, "“"+ids+"”目标,未知错误"); error(1, "“" + ids + "”目标,未知错误");
return false; return false;
} }
} }
var data_list = {}; var data_list = {};
if(data.data){ if (data.data) {
for(var i in data.data){ for (var i in data.data) {
if(typeof data.data[i].data != "undefined"){ if (typeof data.data[i].data != "undefined") {
data_list[i] = data.data[i].data; data_list[i] = data.data[i].data;
} }
} }
@ -57,229 +56,232 @@ var fns = {
return data_list; return data_list;
}, },
//数据处理 ceil向上取整 //数据处理 ceil向上取整
number_pre:function(number,pre){ number_pre: function(number, pre) {
switch(pre){ switch (pre) {
case 'ceil': case 'ceil':
return Math.ceil(number) return Math.ceil(number)
break; break;
}
},
//保留两位小数
number_floor_2: function(number) {
var number = number * 100;
number = Math.floor(number)
number = number / 100;
return number.toFixed(2);
},
//错误信息处理
err: function(title, data, _json, fun) {
if (data) {
if (_json) {
data = JSON.stringify(data)
} }
}, console.log(title + ' :', data)
//保留两位小数 uni.showToast({
number_floor_2:function(number){ title: title + ' : ' + data,
var number = number * 100; icon: 'none',
number = Math.floor(number) duration: 1500,
number = number/100;
return number.toFixed(2);
},
//错误信息处理
err:function(title,data,_json,fun){
if(data){
if(_json){
data=JSON.stringify(data)
}
console.log(title+' :',data)
uni.showToast({
title:title+' : '+data,
icon:'none',
duration:1500,
success() {
if(fun){
fun();
}
}
})
}else{
console.log(title)
uni.showToast({
title:title,
icon:'none',
duration:1500,
success() {
if(fun){
fun();
}
}
})
}
},
//成功信息处理
success(title,fun){
if(fun){
fun();
}
uni.hideLoading();
/* uni.showToast({
title:title,
icon:'success',
success() { success() {
if(fun){ if (fun) {
fun(); fun();
} }
} }
}) */
},
//敬请期待
waiting:function(){
uni.showToast({
title:'敬请期待',
icon:'none'
})
},
//授权验证
oauth_:function(){
uni.setStorage({
key:'oauth',
data:true
})
},
noauth:function(){
uni.setStorage({
key:'oauth',
data:false
})
},
//绑定验证
unionid:function(){
uni.setStorage({
key:'unionid',
data:true
})
},
nunionid:function(){
uni.setStorage({
key:'unionid',
data:false
}) })
}, } else {
//绑定 console.log(title)
bind:function(){ uni.showToast({
console.log('oauth'); title: title,
uni.getStorage({ icon: 'none',
key:'oauth', duration: 1500,
success(re) { success() {
console.log('oauth',re); if (fun) {
fun();
}
} }
}) })
}, }
//获取指定url参数
getUrlQuery:function (urlStr) { },
// var urlStr = location.search.substr(1) ? location.search.substr(1) : ""; //成功信息处理
var urlArr = []; success(title, fun) {
for(var i = 0; i < urlStr.split("&").length; i++) { if (fun) {
urlArr.push(urlStr.split("&")[i].split("=")[0] ? urlStr.split("&")[i].split("=")[0] : ""); fun();
urlArr.push(urlStr.split("&")[i].split("=")[1] ? urlStr.split("&")[i].split("=")[1] : "onlyKey") }
uni.hideLoading();
/* uni.showToast({
title:title,
icon:'success',
success() {
if(fun){
fun();
}
} }
if(urlStr == "") { }) */
return; },
} else { //敬请期待
var urlObj = {} waiting: function() {
for(var i = 0; i < urlArr.length; i += 2) { uni.showToast({
if(urlArr[i] != "") { title: '敬请期待',
urlObj[urlArr[i]] = decodeURIComponent(urlArr[i + 1]); icon: 'none'
} })
},
//授权验证
oauth_: function() {
uni.setStorage({
key: 'oauth',
data: true
})
},
noauth: function() {
uni.setStorage({
key: 'oauth',
data: false
})
},
//绑定验证
unionid: function() {
uni.setStorage({
key: 'unionid',
data: true
})
},
nunionid: function() {
uni.setStorage({
key: 'unionid',
data: false
})
},
//绑定
bind: function() {
console.log('oauth');
uni.getStorage({
key: 'oauth',
success(re) {
console.log('oauth', re);
}
})
},
//获取指定url参数
getUrlQuery: function(urlStr) {
// var urlStr = location.search.substr(1) ? location.search.substr(1) : "";
var urlArr = [];
for (var i = 0; i < urlStr.split("&").length; i++) {
urlArr.push(urlStr.split("&")[i].split("=")[0] ? urlStr.split("&")[i].split("=")[0] : "");
urlArr.push(urlStr.split("&")[i].split("=")[1] ? urlStr.split("&")[i].split("=")[1] : "onlyKey")
}
if (urlStr == "") {
return;
} else {
var urlObj = {}
for (var i = 0; i < urlArr.length; i += 2) {
if (urlArr[i] != "") {
urlObj[urlArr[i]] = decodeURIComponent(urlArr[i + 1]);
} }
return urlObj;
} }
return urlObj;
} }
, },
// url参数解析 // url参数解析
getUrlkey:function(url) { getUrlkey: function(url) {
var params = {}; var params = {};
var urls = url.split("?"); console.log('1_分割url:', urls) var urls = url.split("?");
var arr = urls[1].split("&"); console.log('2_分割urls[1]:', arr) console.log('1_分割url:', urls)
for (var i = 0, l = arr.length; i < l; i++) { var arr = urls[1].split("&");
var a = arr[i].split("="); console.log('3_遍历 arr 并分割后赋值给a:', a[0], a[1]) console.log('2_分割urls[1]:', arr)
params[a[0]] = a[1]; console.log('4_a给params对象赋值:', params) for (var i = 0, l = arr.length; i < l; i++) {
} console.log('5_结果:', params) var a = arr[i].split("=");
return params; console.log('3_遍历 arr 并分割后赋值给a:', a[0], a[1])
params[a[0]] = a[1];
console.log('4_a给params对象赋值:', params)
} }
, console.log('5_结果:', params)
toast(tit,url,time){ return params;
if(!time){ },
time=1500 toast(tit, url, time) {
} if (!time) {
uni.showToast({ time = 1500
title:tit, }
success() { uni.showToast({
setTimeout(function(){ title: tit,
uni.reLaunch({ success() {
url:url setTimeout(function() {
}) uni.reLaunch({
},time) url: url
} })
}) }, time)
},
setSystemInfoSync(){
uni.getStorage({
key:'SystemInfoSync',
fail(err) {
console.log('设置缓存');
try {
console.log('star');
const res = uni.getSystemInfoSync();
console.log('config'+JSON.stringify(res));
uni.setStorage({
key:'SystemInfoSync',
data:res
})
console.log('ok');
} catch (e) {
console.log('catch+'+JSON.stringify(e));
// error
}
},
})
},
getCompare(Version,newVersion,fun){
if(Version==newVersion){
console.log('没有更新');
return
} }
console.log('接收到参数'); })
uni.getStorage({ },
key:'SystemInfoSync', setSystemInfoSync() {
success(res) { uni.getStorage({
console.log('缓存:'+JSON.stringify(res)); key: 'SystemInfoSync',
if(res.data){ fail(err) {
var SystemInfoSync=res.data; console.log('设置缓存');
console.log('json:'+JSON.stringify(SystemInfoSync)); try {
console.log('设备:'+SystemInfoSync.platform); console.log('star');
if(SystemInfoSync.platform=='android'){
console.log('设备:安卓');
fun();
}
}else{
return this.setSystemInfo();
}
},
fail(err) {
console.log('缓存获取失败'+JSON.stringify(err));
const res = uni.getSystemInfoSync(); const res = uni.getSystemInfoSync();
console.log('config'+JSON.stringify(res)); console.log('config' + JSON.stringify(res));
uni.setStorage({ uni.setStorage({
key:'SystemInfoSync', key: 'SystemInfoSync',
data:res, data: res
success() { })
if(res.platform=='android'){ console.log('ok');
console.log('设备:安卓'); } catch (e) {
fun(); console.log('catch+' + JSON.stringify(e));
} // error
}
})
},
complete() {
console.log('获取缓存');
} }
}) },
})
},
getCompare(Version, newVersion, fun) {
if (Version == newVersion) {
console.log('没有更新');
return
} }
//------------------------ console.log('接收到参数');
uni.getStorage({
key: 'SystemInfoSync',
success(res) {
console.log('缓存:' + JSON.stringify(res));
if (res.data) {
var SystemInfoSync = res.data;
console.log('json:' + JSON.stringify(SystemInfoSync));
console.log('设备:' + SystemInfoSync.platform);
if (SystemInfoSync.platform == 'android') {
console.log('设备:安卓');
fun();
}
} else {
return this.setSystemInfo();
}
},
fail(err) {
console.log('缓存获取失败' + JSON.stringify(err));
const res = uni.getSystemInfoSync();
console.log('config' + JSON.stringify(res));
uni.setStorage({
key: 'SystemInfoSync',
data: res,
success() {
if (res.platform == 'android') {
console.log('设备:安卓');
fun();
}
}
})
},
complete() {
console.log('获取缓存');
}
})
}
//------------------------
}; };
export default fns; export default fns;

116
mallplusui-uniapp-app/pages/order/orderDetail.vue

@ -8,14 +8,14 @@
<view class="i-top b-b"> <view class="i-top b-b">
<text class="state" :style="{ color: orderInfo.stateTipColor }">{{orderInfo.orderSn}}</text> <text class="state" :style="{ color: orderInfo.stateTipColor }">{{orderInfo.orderSn}}</text>
</view> </view>
<view class="i-top b-b"> <view class="i-top b-b">
<text class="time">{{ orderInfo.createTime }}</text> <text class="time">{{ orderInfo.createTime }}</text>
<!-- <text class="state" :style="{ color: orderInfo.stateTipColor }" @click="navToDetailPage(item)">{{ orderInfo.id }}--</text> --> <!-- <text class="state" :style="{ color: orderInfo.stateTipColor }" @click="navToDetailPage(item)">{{ orderInfo.id }}--</text> -->
<text class="state" <text class="state"
:style="{ color: orderInfo.stateTipColor }">{{ orderInfo.stateTip }}</text> :style="{ color: orderInfo.stateTipColor }">{{ orderInfo.stateTip }}</text>
</view> </view>
<view v-if="goodsItem.type === 1" class="goods-box-single" <view v-if="goodsItem.type === 1" class="goods-box-single"
v-for="(goodsItem, goodsIndex) in orderInfo.orderItemList" :key="goodsIndex"> v-for="(goodsItem, goodsIndex) in orderInfo.orderItemList" :key="goodsIndex">
<img class="goods-img" :src="goodsItem.productPic" mode="aspectFill"></img> <img class="goods-img" :src="goodsItem.productPic" mode="aspectFill"></img>
@ -25,13 +25,13 @@
<text class="attr-box">x {{ goodsItem.productQuantity }}</text> <text class="attr-box">x {{ goodsItem.productQuantity }}</text>
<text class="price">{{ goodsItem.productPrice }}</text> <text class="price">{{ goodsItem.productPrice }}</text>
</view> </view>
<view style="display: flex;flex-direction: row;"> <view style="display: flex;flex-direction: row;">
<text style="color: #c1c1c1;font-size: 13px;" <text style="color: #c1c1c1;font-size: 13px;"
v-if="orderInfo.status === 5||orderInfo.status === 3">{{orderInfo.deliveryCompany}}</text> v-if="orderInfo.status === 5||orderInfo.status === 3">{{orderInfo.deliveryCompany}}</text>
<text style="color: #c1c1c1;font-size: 13px;" <text style="color: #c1c1c1;font-size: 13px;"
v-if="orderInfo.status === 5||orderInfo.status === 3">{{ orderInfo.deliverySn }}</text> v-if="orderInfo.status === 5||orderInfo.status === 3">{{ orderInfo.deliverySn }}</text>
</view> </view>
</view> </view>
</view> </view>
<!-- <view class="i-top b-b"> <!-- <view class="i-top b-b">
@ -48,34 +48,34 @@
</view> </view>
</view> --> </view> -->
<view style="display: flex;flex-direction: column; margin-right: 13px;margin-bottom: 10px;"> <view style="display: flex;flex-direction: column; margin-right: 13px;margin-bottom: 10px;">
<view class="price-box"> <view class="price-box">
<text class="num">{{ orderInfo.orderItemList.length }}</text> <text class="num">{{ orderInfo.orderItemList.length }}</text>
件商品, 会员折扣 件商品, 会员折扣
<text class="price">{{ orderInfo.vipAmount }}</text> <text class="price">{{ orderInfo.vipAmount }}</text>
, 优惠券抵扣 , 优惠券抵扣
<text class="price">{{ orderInfo.couponAmount }}</text> <text class="price">{{ orderInfo.couponAmount }}</text>
</view> </view>
<view class="price-box"> <view class="price-box">
积分抵扣 积分抵扣
<text class="price">{{ orderInfo.integrationAmount }}</text> <text class="price">{{ orderInfo.integrationAmount }}</text>
, 运费 , 运费
<text class="price">{{ orderInfo.freightAmount }}</text> <text class="price">{{ orderInfo.freightAmount }}</text>
<!-- <view class="yt-list-cell b-b" v-if="groupActivity"> <!-- <view class="yt-list-cell b-b" v-if="groupActivity">
<text class="cell-tit clamp">活动金额</text> <text class="cell-tit clamp">活动金额</text>
<text class="cell-tip">{{ groupActivity.price }}</text> <text class="cell-tip">{{ groupActivity.price }}</text>
</view> --> </view> -->
, 实付款 , 实付款
<text class="price">{{ orderInfo.payAmount }}</text> <text class="price">{{ orderInfo.payAmount }}</text>
</view>
</view> </view>
</view>
<view class="action-box b-t" v-if="orderInfo.status==12||orderInfo.status==3"> <view class="action-box b-t" v-if="orderInfo.status==12||orderInfo.status==3">
<button v-if="orderInfo.status == 12" class="action-btn" <button v-if="orderInfo.status == 12" class="action-btn"
@click="cancelOrder(orderInfo)">取消订单</button> @click="cancelOrder(orderInfo)">取消订单</button>
<button v-if="orderInfo.status == 12" class="action-btn recom" <button v-if="orderInfo.status == 12" class="action-btn recom"
@click="payOrder(orderInfo)">立即支付</button> @click="payOrder(orderInfo)">立即支付</button>
<!-- <button v-if="orderInfo.status <7" class="action-btn recom" <!-- <button v-if="orderInfo.status <7" class="action-btn recom"
@click="applyRefund(orderInfo.id)">申请售后</button> --> @click="applyRefund(orderInfo.id)">申请售后</button> -->
<button v-if="orderInfo.status == 3" class="action-btn recom" <button v-if="orderInfo.status == 3" class="action-btn recom"
@click="confimDelivery(orderInfo)">确认收货</button> @click="confimDelivery(orderInfo)">确认收货</button>
@ -112,7 +112,7 @@
return { return {
tabCurrentIndex: 0, tabCurrentIndex: 0,
orderInfo: { orderInfo: {
orderItemList:[] orderItemList: []
}, },
navList: [{ navList: [{
status: 0, status: 0,
@ -212,6 +212,12 @@
if (data) { if (data) {
this.$api.msg(data); this.$api.msg(data);
let params = {
id: item.id
};
this.orderInfo = await Api.apiCall('get', Api.order.orderDetail, params);
this.orderInfo = Object.assign(this.orderInfo, this.orderStateExp(this.orderInfo.status));
this.orderInfo.createTime = this.dateFormat(this.orderInfo.createTime);
} }
uni.hideLoading(); uni.hideLoading();
}, },
@ -247,11 +253,11 @@
orderStateExp(value) { orderStateExp(value) {
let stateTip = '', let stateTip = '',
stateTipColor = '#fa436a'; stateTipColor = '#fa436a';
if (value === 1) { if (value === 1) {
stateTipColor = '#909399'; stateTipColor = '#909399';
stateTip= '支付成功,没有回掉'; stateTip = '支付成功,没有回掉';
}else if (value === 2) { } else if (value === 2) {
stateTip = '待发货'; stateTip = '待发货';
} else if (value === 3) { } else if (value === 3) {
stateTip = '待收货'; stateTip = '待收货';
@ -266,9 +272,9 @@
stateTip = ' 维权已完成'; stateTip = ' 维权已完成';
} else if (value === 8) { } else if (value === 8) {
stateTip = '待分享'; stateTip = '待分享';
}else if (value === 12) { } else if (value === 12) {
stateTipColor = '#909399'; stateTipColor = '#909399';
stateTip= '待付款'; stateTip = '待付款';
} else if (value === 13) { } else if (value === 13) {
stateTip = '申请退款'; stateTip = '申请退款';
} else if (value === 14) { } else if (value === 14) {
@ -439,31 +445,31 @@
line-height: 1; line-height: 1;
} }
.num_price { .num_price {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
justify-content: space-between; justify-content: space-between;
margin-top: 5px; margin-top: 5px;
.attr-box { .attr-box {
flex: 1; flex: 1;
font-size: $font-sm + 2upx; font-size: $font-sm + 2upx;
color: $font-color-light; color: $font-color-light;
margin: 0 2upx 0 8upx;
}
.price {
font-size: $font-base + 2upx;
color: $font-color-dark;
&:before {
content: '¥';
font-size: $font-sm;
margin: 0 2upx 0 8upx; margin: 0 2upx 0 8upx;
} }
.price {
font-size: $font-base + 2upx;
color: $font-color-dark;
&:before {
content: '¥';
font-size: $font-sm;
margin: 0 2upx 0 8upx;
}
}
} }
} }
}
} }
.price-box { .price-box {

329
mallplusui-uniapp-app/pagesU/user/coupon.vue

@ -1,21 +1,26 @@
<template> <template>
<view> <view>
<view class="tabr" :style="{top:headerTop}"> <view class="tabr" :style="{top:headerTop}">
<view :class="{on:typeClass=='valid'}" @tap="switchType('valid')">可用({{couponValidList.length}})</view><view :class="{on:typeClass=='invalid'}" @tap="switchType('invalid')">已失效({{couponinvalidList.length}})</view> <view :class="{on:typeClass=='valid'}" @tap="switchType('valid')">可用({{couponValidList.length}})</view>
<view :class="{on:typeClass=='invalid'}" @tap="switchType('invalid')">已失效({{couponinvalidList.length}})
</view>
<view class="border" :class="typeClass"></view> <view class="border" :class="typeClass"></view>
</view> </view>
<view class="place" ></view> <view class="place"></view>
<view class="list"> <view class="list">
<!-- 优惠券列表 --> <!-- 优惠券列表 -->
<view class="sub-list valid" :class="subState"> <view class="sub-list valid" :class="subState">
<view class="tis" v-if="couponValidList.length==0">没有数据~</view> <view class="tis" v-if="couponValidList.length==0">没有数据~</view>
<view class="row" v-for="(row,index) in couponValidList" :key="index" > <view class="row" v-for="(row,index) in couponValidList" :key="index">
<!-- 删除按钮 --> <!-- 删除按钮 -->
<view class="menu" @tap.stop="deleteCoupon(row.id,couponValidList)"> <view class="menu" @tap.stop="deleteCoupon(row.id,couponValidList)">
<view class="icon shanchu"></view> <view class="icon shanchu"></view>
</view> </view>
<!-- content --> <!-- content -->
<view class="carrier" :class="[typeClass=='valid'?theIndex==index?'open':oldIndex==index?'close':'':'']" @touchstart="touchStart(index,$event)" @touchmove="touchMove(index,$event)" @touchend="touchEnd(index,$event)"> <view class="carrier"
:class="[typeClass=='valid'?theIndex==index?'open':oldIndex==index?'close':'':'']"
@touchstart="touchStart(index,$event)" @touchmove="touchMove(index,$event)"
@touchend="touchEnd(index,$event)">
<view class="left"> <view class="left">
<view class="title"> <view class="title">
{{row.note}} {{row.note}}
@ -51,13 +56,16 @@
</view> </view>
<view class="sub-list invalid" :class="subState"> <view class="sub-list invalid" :class="subState">
<view class="tis" v-if="couponinvalidList.length==0">没有数据~</view> <view class="tis" v-if="couponinvalidList.length==0">没有数据~</view>
<view class="row" v-for="(row,index) in couponinvalidList" :key="index" > <view class="row" v-for="(row,index) in couponinvalidList" :key="index">
<!-- 删除按钮 --> <!-- 删除按钮 -->
<view class="menu" @tap.stop="deleteCoupon(row.id,couponinvalidList)"> <view class="menu" @tap.stop="deleteCoupon(row.id,couponinvalidList)">
<view class="icon shanchu"></view> <view class="icon shanchu"></view>
</view> </view>
<!-- content --> <!-- content -->
<view class="carrier" :class="[typeClass=='invalid'?theIndex==index?'open':oldIndex==index?'close':'':'']" @touchstart="touchStart(index,$event)" @touchmove="touchMove(index,$event)" @touchend="touchEnd(index,$event)"> <view class="carrier"
:class="[typeClass=='invalid'?theIndex==index?'open':oldIndex==index?'close':'':'']"
@touchstart="touchStart(index,$event)" @touchmove="touchMove(index,$event)"
@touchend="touchEnd(index,$event)">
<view class="left"> <view class="left">
<view class="title"> <view class="title">
{{row.note}} {{row.note}}
@ -100,159 +108,161 @@
</template> </template>
<script> <script>
import mallplusCopyright from '@/components/mall-copyright/mallplusCopyright.vue'; import mallplusCopyright from '@/components/mall-copyright/mallplusCopyright.vue';
import Api from '@/common/api'; import Api from '@/common/api';
import eonfox from '@/components/eonfox/eonfox.js'; import eonfox from '@/components/eonfox/eonfox.js';
import fns from '@/components/eonfox/fns.js'; import fns from '@/components/eonfox/fns.js';
import { formatDate } from '@/common/date'; import {
formatDate
} from '@/common/date';
var ef = new eonfox(); var ef = new eonfox();
export default { export default {
data() { data() {
return { return {
couponValidList:[ couponValidList: [
// {id:1,title:"10",termStart:"2019-04-01",termEnd:"2019-05-30",ticket:"10",criteria:"50使"}, // {id:1,title:"10",termStart:"2019-04-01",termEnd:"2019-05-30",ticket:"10",criteria:"50使"},
// {id:2,title:"100",termStart:"2019-04-01",termEnd:"2019-05-30",ticket:"100",criteria:"500使"}, // {id:2,title:"100",termStart:"2019-04-01",termEnd:"2019-05-30",ticket:"100",criteria:"500使"},
// {id:3,title:"10",termStart:"2019-04-01",termEnd:"2019-05-30",ticket:"10",criteria:""}, // {id:3,title:"10",termStart:"2019-04-01",termEnd:"2019-05-30",ticket:"10",criteria:""},
// {id:4,title:"50",termStart:"2019-04-01",termEnd:"2019-05-30",ticket:"50",criteria:"1000使"} // {id:4,title:"50",termStart:"2019-04-01",termEnd:"2019-05-30",ticket:"50",criteria:"1000使"}
], ],
couponinvalidList:[ couponinvalidList: [
// {id:1,title:"10",termStart:"2019-04-01",termEnd:"2019-05-30",ticket:"10",criteria:"50使"}, // {id:1,title:"10",termStart:"2019-04-01",termEnd:"2019-05-30",ticket:"10",criteria:"50使"},
// {id:2,title:"100",termStart:"2019-04-01",termEnd:"2019-05-30",ticket:"100",criteria:"500使"}, // {id:2,title:"100",termStart:"2019-04-01",termEnd:"2019-05-30",ticket:"100",criteria:"500使"},
// {id:3,title:"10",termStart:"2019-04-01",termEnd:"2019-05-30",ticket:"10",criteria:""}, // {id:3,title:"10",termStart:"2019-04-01",termEnd:"2019-05-30",ticket:"10",criteria:""},
// {id:4,title:"50",termStart:"2019-04-01",termEnd:"2019-05-30",ticket:"50",criteria:"1000使"} // {id:4,title:"50",termStart:"2019-04-01",termEnd:"2019-05-30",ticket:"50",criteria:"1000使"}
], ],
headerTop:0, headerTop: 0,
// //
typeClass:'valid', typeClass: 'valid',
subState:'', subState: '',
theIndex:null, theIndex: null,
oldIndex:null, oldIndex: null,
isStop:false isStop: false
} }
}, },
onPageScroll(e){ onPageScroll(e) {
}, },
//page.json "enablePullDownRefresh": true //page.json "enablePullDownRefresh": true
onPullDownRefresh() { onPullDownRefresh() {
setTimeout(function () { setTimeout(function() {
uni.stopPullDownRefresh(); uni.stopPullDownRefresh();
}, 1000); }, 1000);
}, },
onLoad() { onLoad() {
this.getData() this.getData()
//H5 //H5
// #ifdef H5 // #ifdef H5
//onLoadhead //onLoadhead
let Timer = setInterval(()=>{ let Timer = setInterval(() => {
let uniHead = document.getElementsByTagName('uni-page-head'); let uniHead = document.getElementsByTagName('uni-page-head');
if(uniHead.length>0){ if (uniHead.length > 0) {
this.headerTop = uniHead[0].offsetHeight+'px'; this.headerTop = uniHead[0].offsetHeight + 'px';
clearInterval(Timer);// clearInterval(Timer); //
} }
},1); }, 1);
// #endif // #endif
}, },
filters: { filters: {
formatCreateTime(time) { formatCreateTime(time) {
let date = new Date(time); let date = new Date(time);
return formatDate(date, 'yyyy-MM-dd') return formatDate(date, 'yyyy-MM-dd')
}, },
}, },
methods: { methods: {
goUse(){ goUse() {
uni.switchTab({ uni.switchTab({
url:'/pages/index/index' url: '/pages/index/index'
}) })
}, },
async getData(){ async getData() {
let params = { }; let params = {};
let data = await Api.apiCall('get', Api.index.listMemberCoupon, params); let data = await Api.apiCall('get', Api.index.listMemberCoupon, params);
let viewList = data; let viewList = data;
viewList.forEach(item => { viewList.forEach(item => {
if(item.useStatus==0){ if (item.useStatus == 0) {
this.couponValidList.push(item); this.couponValidList.push(item);
}else{ } else {
this.couponinvalidList.push(item); this.couponinvalidList.push(item);
} }
}); });
}, },
switchType(type){ switchType(type) {
// console.log(type) // console.log(type)
if(this.typeClass==type){ if (this.typeClass == type) {
return ; return;
} }
uni.pageScrollTo({ uni.pageScrollTo({
scrollTop:0, scrollTop: 0,
duration:0 duration: 0
}) })
this.typeClass = type; this.typeClass = type;
this.subState = this.typeClass==''?'':'show'+type; this.subState = this.typeClass == '' ? '' : 'show' + type;
setTimeout(()=>{ setTimeout(() => {
this.oldIndex = null; this.oldIndex = null;
this.theIndex = null; this.theIndex = null;
this.subState = this.typeClass=='valid'?'':this.subState; this.subState = this.typeClass == 'valid' ? '' : this.subState;
},200) }, 200)
}, },
//-begin //-begin
touchStart(index,event){ touchStart(index, event) {
// //
if(event.touches.length>1){ if (event.touches.length > 1) {
this.isStop = true; this.isStop = true;
return ; return;
} }
this.oldIndex = this.theIndex; this.oldIndex = this.theIndex;
this.theIndex = null; this.theIndex = null;
// //
this.initXY = [event.touches[0].pageX,event.touches[0].pageY]; this.initXY = [event.touches[0].pageX, event.touches[0].pageY];
}, },
touchMove(index,event){ touchMove(index, event) {
// //
if(event.touches.length>1){ if (event.touches.length > 1) {
this.isStop = true; this.isStop = true;
return ; return;
} }
let moveX = event.touches[0].pageX - this.initXY[0]; let moveX = event.touches[0].pageX - this.initXY[0];
let moveY = event.touches[0].pageY - this.initXY[1]; let moveY = event.touches[0].pageY - this.initXY[1];
if(this.isStop||Math.abs(moveX)<5){ if (this.isStop || Math.abs(moveX) < 5) {
return ; return;
} }
if (Math.abs(moveY) > Math.abs(moveX)){ if (Math.abs(moveY) > Math.abs(moveX)) {
// - // -
this.isStop = true; this.isStop = true;
return; return;
} }
if(moveX<0){ if (moveX < 0) {
this.theIndex = index; this.theIndex = index;
this.isStop = true; this.isStop = true;
}else if(moveX>0){ } else if (moveX > 0) {
if(this.theIndex!=null&&this.oldIndex==this.theIndex){ if (this.theIndex != null && this.oldIndex == this.theIndex) {
this.oldIndex = index; this.oldIndex = index;
this.theIndex = null; this.theIndex = null;
this.isStop = true; this.isStop = true;
setTimeout(()=>{ setTimeout(() => {
this.oldIndex = null; this.oldIndex = null;
},150) }, 150)
} }
} }
}, },
touchEnd(index,$event){ touchEnd(index, $event) {
// //
this.isStop = false; this.isStop = false;
}, },
// //
deleteCoupon(id,List){ deleteCoupon(id, List) {
let len = List.length; let len = List.length;
for(let i=0;i<len;i++){ for (let i = 0; i < len; i++) {
if(id==List[i].id){ if (id == List[i].id) {
List.splice(i, 1); List.splice(i, 1);
break; break;
} }
@ -270,20 +280,27 @@ import Api from '@/common/api';
} }
</script> </script>
<style lang="scss"> <style lang="scss">
view{ view {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
} }
page{position: relative;background-color: #f5f5f5;}
.hidden{ page {
position: relative;
background-color: #f5f5f5;
}
.hidden {
display: none !important; display: none !important;
} }
.place{
.place {
width: 100%; width: 100%;
height: 95upx; height: 95upx;
} }
.tabr{
.tabr {
background-color: #fff; background-color: #fff;
/* #ifdef H5 || MP-WEIXIN*/ /* #ifdef H5 || MP-WEIXIN*/
width: 100% !important; width: 100% !important;
@ -295,7 +312,8 @@ import Api from '@/common/api';
position: fixed; position: fixed;
top: 0; top: 0;
z-index: 10; z-index: 10;
view{
view {
width: 50%; width: 50%;
height: 90upx; height: 90upx;
justify-content: center; justify-content: center;
@ -303,55 +321,79 @@ import Api from '@/common/api';
font-size: 32upx; font-size: 32upx;
color: #999; color: #999;
} }
.on{
.on {
color: $uni-color-success; color: $uni-color-success;
} }
.border{
.border {
height: 4upx; height: 4upx;
background-color: $uni-color-success; background-color: $uni-color-success;
transition: all .3s ease-out; transition: all .3s ease-out;
&.invalid{
transform: translate3d(100%,0,0); &.invalid {
transform: translate3d(100%, 0, 0);
} }
} }
} }
.list{
.list {
width: 100%; width: 100%;
display: block; display: block;
position: relative; position: relative;
} }
@keyframes showValid { @keyframes showValid {
0% {transform: translateX(-100%);}100% {transform: translateX(0);} 0% {
transform: translateX(-100%);
}
100% {
transform: translateX(0);
}
} }
@keyframes showInvalid { @keyframes showInvalid {
0% {transform: translateX(0);}100% {transform: translateX(-100%);} 0% {
transform: translateX(0);
}
100% {
transform: translateX(-100%);
}
} }
.sub-list{
&.invalid{ .sub-list {
&.invalid {
position: absolute; position: absolute;
top: 0; top: 0;
left:100%; left: 100%;
display: none; display: none;
} }
&.showvalid{
&.showvalid {
display: flex; display: flex;
animation: showValid 0.20s linear both; animation: showValid 0.20s linear both;
} }
&.showinvalid{
&.showinvalid {
display: flex; display: flex;
animation: showInvalid 0.20s linear both; animation: showInvalid 0.20s linear both;
} }
width: 100%; width: 100%;
padding: 20upx 0 120upx 0; padding: 20upx 0 120upx 0;
.tis{
.tis {
width: 100%; width: 100%;
height: 60upx; height: 60upx;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
font-size: 32upx; font-size: 32upx;
} }
.row{
.row {
width: 92%; width: 92%;
height: 24vw; height: 24vw;
margin: 20upx auto 10upx auto; margin: 20upx auto 10upx auto;
@ -362,11 +404,13 @@ import Api from '@/common/api';
overflow: hidden; overflow: hidden;
z-index: 4; z-index: 4;
border: 0; border: 0;
.menu{
.icon{ .menu {
.icon {
color: #fff; color: #fff;
font-size:50upx; font-size: 50upx;
} }
position: absolute; position: absolute;
width: 28%; width: 28%;
height: 100%; height: 100%;
@ -377,19 +421,36 @@ import Api from '@/common/api';
color: #fff; color: #fff;
z-index: 2; z-index: 2;
} }
.carrier{
.carrier {
@keyframes showMenu { @keyframes showMenu {
0% {transform: translateX(0);}100% {transform: translateX(-28%);} 0% {
transform: translateX(0);
}
100% {
transform: translateX(-28%);
}
} }
@keyframes closeMenu { @keyframes closeMenu {
0% {transform: translateX(-28%);}100% {transform: translateX(0);} 0% {
transform: translateX(-28%);
}
100% {
transform: translateX(0);
}
} }
&.open{
&.open {
animation: showMenu 0.25s linear both; animation: showMenu 0.25s linear both;
} }
&.close{
&.close {
animation: closeMenu 0.15s linear both; animation: closeMenu 0.15s linear both;
} }
background-color: #fff; background-color: #fff;
position: absolute; position: absolute;
width: 100%; width: 100%;
@ -397,22 +458,28 @@ import Api from '@/common/api';
height: 100%; height: 100%;
z-index: 3; z-index: 3;
flex-wrap: nowrap; flex-wrap: nowrap;
.left{
.left {
width: 100%; width: 100%;
.title{
.title {
padding-top: 3vw; padding-top: 3vw;
width: 90%; width: 90%;
margin: 0 5%; margin: 0 5%;
font-size: 36upx; font-size: 36upx;
} }
.term{
.term {
width: 90%; width: 90%;
margin: 0 5%; margin: 0 5%;
font-size: 26upx; font-size: 26upx;
color: #999; color: #999;
} }
position: relative; position: relative;
.gap-top,.gap-bottom{
.gap-top,
.gap-bottom {
position: absolute; position: absolute;
width: 20upx; width: 20upx;
height: 20upx; height: 20upx;
@ -420,52 +487,68 @@ import Api from '@/common/api';
border-radius: 100%; border-radius: 100%;
background-color: #f5f5f5; background-color: #f5f5f5;
} }
.gap-top{
.gap-top {
top: -10upx; top: -10upx;
} }
.gap-bottom{
.gap-bottom {
bottom: -10upx; bottom: -10upx;
} }
.shixiao{
.shixiao {
position: absolute; position: absolute;
right: 20upx; right: 20upx;
font-size: 150upx; font-size: 150upx;
z-index: 6; z-index: 6;
color: rgba(153,153,153,0.2) color: rgba(153, 153, 153, 0.2)
} }
} }
.right{
.right {
flex-shrink: 0; flex-shrink: 0;
width: 28%; width: 28%;
color: #fff; color: #fff;
background:linear-gradient(to right,#ec625c,#ee827f); background: linear-gradient(to right, #ec625c, #ee827f);
&.invalid{
background:linear-gradient(to right,#aaa,#999); &.invalid {
.use{ background: linear-gradient(to right, #aaa, #999);
.use {
color: #aaa; color: #aaa;
} }
} }
justify-content: center; justify-content: center;
.ticket,.criteria{width: 100%;}
.ticket{ .ticket,
.criteria {
width: 100%;
}
.ticket {
padding-top: 1vw; padding-top: 1vw;
justify-content: center; justify-content: center;
align-items: baseline; align-items: baseline;
height: 6vw; height: 6vw;
.num{
.num {
font-size: 42upx; font-size: 42upx;
font-weight: 600; font-weight: 600;
} }
.unit{
.unit {
font-size: 24upx; font-size: 24upx;
} }
} }
.criteria{
.criteria {
justify-content: center; justify-content: center;
font-size: 28upx; font-size: 28upx;
} }
.use{
.use {
width: 50%; width: 50%;
height: 40upx; height: 40upx;
justify-content: center; justify-content: center;
@ -478,6 +561,7 @@ import Api from '@/common/api';
} }
} }
} }
/* /*
<view class="carrier" :class="[theIndex==index?'open':oldIndex==index?'close':'']" @touchstart="touchStart(index,$event)" @touchmove="touchMove(index,$event)" @touchend="touchEnd(index,$event)"> <view class="carrier" :class="[theIndex==index?'open':oldIndex==index?'close':'']" @touchstart="touchStart(index,$event)" @touchmove="touchMove(index,$event)" @touchend="touchEnd(index,$event)">
<view class="left"> <view class="left">
@ -509,5 +593,4 @@ import Api from '@/common/api';
* */ * */
} }
} }
</style> </style>

824
mallplusui-uniapp-app/pagesU/user/deposit.vue

File diff suppressed because it is too large
Loading…
Cancel
Save