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. 210
      mallplusui-uniapp-app/components/eonfox/fns.js
  4. 16
      mallplusui-uniapp-app/pages/order/orderDetail.vue
  5. 295
      mallplusui-uniapp-app/pagesU/user/coupon.vue
  6. 294
      mallplusui-uniapp-app/pagesU/user/deposit.vue

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

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

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

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

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

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

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

@ -112,7 +112,7 @@
return {
tabCurrentIndex: 0,
orderInfo: {
orderItemList:[]
orderItemList: []
},
navList: [{
status: 0,
@ -212,6 +212,12 @@
if (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();
},
@ -250,8 +256,8 @@
if (value === 1) {
stateTipColor = '#909399';
stateTip= '支付成功,没有回掉';
}else if (value === 2) {
stateTip = '支付成功,没有回掉';
} else if (value === 2) {
stateTip = '待发货';
} else if (value === 3) {
stateTip = '待收货';
@ -266,9 +272,9 @@
stateTip = ' 维权已完成';
} else if (value === 8) {
stateTip = '待分享';
}else if (value === 12) {
} else if (value === 12) {
stateTipColor = '#909399';
stateTip= '待付款';
stateTip = '待付款';
} else if (value === 13) {
stateTip = '申请退款';
} else if (value === 14) {

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

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

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

@ -1,10 +1,10 @@
<template>
<view>
<view class="block">
<view class="title">
<!-- <view class="title">
<text>我的账户</text>
<text style="font-size: 28rpx;padding-left: 60rpx;color: #007AFF;" @click="gominxi">交易明细</text>
</view>
</view> -->
<view class="content">
<view class="my">
@ -19,7 +19,8 @@
<view class="content">
<view class="amount">
<view class="list">
<view class="box" v-for="(amount,index) in amountList" :key="index" @tap="select(amount)" :class="{'on':amount == inputAmount}">
<view class="box" v-for="(amount,index) in amountList" :key="index" @tap="select(amount)"
:class="{'on':amount == inputAmount}">
{{amount}}
</view>
</view>
@ -43,7 +44,7 @@
<!-- #ifdef APP-PLUS -->
<view class="row" @tap="paytype='alipay'">
<view class="left">
<image src="../../static/img/alipay.png"></image>
<image style="width: 30px;height: 30px;" src="../../static/img/alipay.png"></image>
</view>
<view class="center">
支付宝支付
@ -55,7 +56,7 @@
<!-- #endif -->
<view class="row" @tap="paytype='wxpay'">
<view class="left">
<image src="../../static/image/wechatpay.png"></image>
<image style="width: 30px;height: 30px;" src="../../static/image/wechatpay.png"></image>
</view>
<view class="center">
微信支付
@ -75,90 +76,99 @@
</view>
</view> -->
</view>
<view class="pay">
<!-- <view class="pay">
<view class="btn btn-tixi" @click="gopage">去提现</view>
</view>
</view> -->
</view>
</template>
<script>
import mallplusCopyright from '@/components/mall-copyright/mallplusCopyright.vue';
import Api from '@/common/api';
import mallplusCopyright from '@/components/mall-copyright/mallplusCopyright.vue';
import Api from '@/common/api';
import eonfox from '@/components/eonfox/eonfox.js';
import fns from '@/components/eonfox/fns.js';
var ef=new eonfox()
var ef = new eonfox()
export default {
data() {
return {
money:0,
inputAmount:'',//
amountList:[100,200,500],//3
paytype:'wxpay'//
money: 0,
inputAmount: '', //
amountList: [100, 200, 500], //3
paytype: 'wxpay' //
};
},
onShow(){
onShow() {
this.load()
},
methods:{
async load(){
let params = { };
methods: {
async load() {
let params = {};
let data1 = await Api.apiCall('get', Api.member.currentMember, params);
this.money = data1.blance;
},
async onload() {
let params = { };
let params = {};
let data1 = await Api.apiCall('get', Api.index.currentMember, params);
this.money = data1.blance;
},
select(amount){
select(amount) {
this.inputAmount = amount;
},
doDeposit(){
if(this.paytype=='alipay'){
doDeposit() {
if (this.paytype == 'alipay') {
console.log('支付宝')
return
}else{
} else {
console.log('微信')
return
}
if (parseFloat(this.inputAmount).toString() == "NaN") {
uni.showToast({title:'请输入正确金额',icon:'none'});
return ;
uni.showToast({
title: '请输入正确金额',
icon: 'none'
});
return;
}
if(this.inputAmount<=0){
uni.showToast({title:'请输入大于100的金额',icon:'none'});
return ;
if (this.inputAmount <= 0) {
uni.showToast({
title: '请输入大于100的金额',
icon: 'none'
});
return;
}
if(parseFloat(this.inputAmount).toFixed(2)!=parseFloat(this.inputAmount)){
uni.showToast({title:'最多只能输入两位小数哦~',icon:'none'});
return ;
if (parseFloat(this.inputAmount).toFixed(2) != parseFloat(this.inputAmount)) {
uni.showToast({
title: '最多只能输入两位小数哦~',
icon: 'none'
});
return;
}
///
uni.showLoading({
title:'支付中...'
title: '支付中...'
});
setTimeout(()=>{
setTimeout(() => {
uni.hideLoading();
uni.showToast({
title:'支付成功'
title: '支付成功'
});
setTimeout(()=>{
setTimeout(() => {
uni.switchTab({
url:'../../pages/index/user'
url: '../../pages/index/user'
});
},300);
},700)
}, 300);
}, 700)
},
pay(){
var _this=this
if(!/^\d+(\.\d+)?$/.test(_this.inputAmount)||_this.inputAmount<=0){
pay() {
var _this = this
if (!/^\d+(\.\d+)?$/.test(_this.inputAmount) || _this.inputAmount <= 0) {
uni.showToast({
title:'请输入正确金额',
icon:'none'
title: '请输入正确金额',
icon: 'none'
})
}else{
if(_this.paytype!='alipay'){
} else {
if (_this.paytype != 'alipay') {
_this.WeChatPay()
// // #ifdef MP-WEIXIN
// _this.pay_mp_weixin()
@ -167,11 +177,11 @@ import Api from '@/common/api';
// _this.pay_APP_weixin()
// // #endif
}
if(_this.paytype=='alipay'){
if (_this.paytype == 'alipay') {
// #ifdef H5 || MP-WEIXIN
uni.showToast({
title: '开发中。。。',
icon:'none'
icon: 'none'
});
// #endif
// #ifdef APP-PLUS
@ -182,80 +192,67 @@ import Api from '@/common/api';
}
},
payAli(){
var _this=this;
payAli() {
var _this = this;
ef.submit({
request: {
s: ['APPLICATIONORDERSELFBUYUSERMONEY', [{
money_fen:_this.inputAmount*100,//|()
money_fen: _this.inputAmount * 100, //|()
pay_method: 'alipay', // weixinpay alipay
alipay_trade_type:'APP'
} ]]
alipay_trade_type: 'APP'
}]]
},
callback(data){
console.log('调起支付宝支付',data)
callback(data) {
console.log('调起支付宝支付', data)
fns.checkError(data,'s',function(errno,error){
fns.checkError(data, 's', function(errno, error) {
uni.showToast({
title:error,
icon:'none'
title: error,
icon: 'none'
})
})
var ali=data.data.s.data.alipay
if(ali){
var ali = data.data.s.data.alipay
if (ali) {
uni.requestPayment({
provider: 'alipay',
orderInfo:ali,
success: function (res) {
orderInfo: ali,
success: function(res) {
console.log('success:' + JSON.stringify(res));
_this.onload()
uni.showToast({
title:'充值成功',
icon:'none'
title: '充值成功',
icon: 'none'
})
},
fail: function (err) {
fail: function(err) {
console.log('fail:' + JSON.stringify(err));
}
});
}
},
error(err){
fns.err('提交订单失败',err,1)
error(err) {
fns.err('提交订单失败', err, 1)
}
})
},
//
WeChatPay(){
var _this=this
// if (!/^\d+(\.\d+)?$/.test(_this.pay_money) || _this.pay_money <= 0) {
// uni.showToast({
// title: '',
// icon: 'none'
// });
// }else{
var money_fen=_this.inputAmount*100
// if(_this.tabIndex!=0){
// money_fen=_this.tabIndex*100
// }else{
// money_fen=_this.pay_money*100
// }
WeChatPay() {
var _this = this
var money_fen = _this.inputAmount * 100
// APP
// #ifdef APP-PLUS
ef.submit({
request: {
s: [
'APPLICATIONORDERSELFBUYUSERMONEY',
[
{
[{
money_fen: money_fen, //|()
pay_method: 'weixinpay', // weixinpay alipay
weixin_trade_type: 'APP'
}
]
}]
]
},
callback: function(data) {
@ -300,8 +297,7 @@ import Api from '@/common/api';
request: {
s: [
'APPLICATIONORDERSELFBUYUSERMONEY',
[
{
[{
money_fen: money_fen, //|()
// #ifdef MP-WEIXIN
weixin_login_code: _this.code,
@ -313,8 +309,7 @@ import Api from '@/common/api';
pay_method: 'weixinpay', // weixinpay alipay
weixin_trade_type: 'APP'
// #endif
}
]
}]
]
},
callback: function(data) {
@ -376,14 +371,12 @@ import Api from '@/common/api';
ef.submit({
request: {
s: ['APPLICATIONORDERSELFBUYUSERMONEY',
[
{
[{
money_fen: money_fen, //|()
pay_method: 'weixinpay', // weixinpay alipay
weixin_trade_type: 'MPJSAPI',
weixin_login_openid: dataList.s.openid
}
]
}]
]
},
@ -401,9 +394,11 @@ import Api from '@/common/api';
var getBrandWCPayRequest = {
appId: ress.appid,
timeStamp: String(ress.time_stamp), // jssdk使timestamp使timeStampS
timeStamp: String(ress
.time_stamp), // jssdk使timestamp使timeStampS
nonceStr: ress.nonce_str, // 32
package: 'prepay_id=' + ress.prepay_id, // prepay_idprepay_id=\*\*\*
package: 'prepay_id=' + ress
.prepay_id, // prepay_idprepay_id=\*\*\*
signType: ress.sign_type, // 'SHA1'使'MD5'
paySign: ress.pay_sign, //
};
@ -426,13 +421,15 @@ import Api from '@/common/api';
}
})
}
if (res.err_msg == "get_brand_wcpay_request:fail") {
if (res.err_msg ==
"get_brand_wcpay_request:fail") {
uni.showToast({
title: '支付失败',
icon: 'none'
})
}
if (res.err_msg == "get_brand_wcpay_request:cancel") {
if (res.err_msg ==
"get_brand_wcpay_request:cancel") {
uni.showToast({
title: '已取消支付',
icon: 'none',
@ -450,10 +447,12 @@ import Api from '@/common/api';
if (typeof WeixinJSBridge == "undefined") {
if (document.addEventListener) {
document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
document.addEventListener('WeixinJSBridgeReady',
onBridgeReady, false);
} else if (document.attachEvent) {
document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
document.attachEvent('onWeixinJSBridgeReady',
onBridgeReady);
}
} else {
onBridgeReady();
@ -480,7 +479,8 @@ import Api from '@/common/api';
// ACCESSTOKEN
ef.left_token(function(left_token) {
var notify_url = encodeURIComponent(location.href);
var url = ef.api_server_url + "?" + encodeURI('data=[["SESSIONWEIXINAUTHORIZE",[{"notify_url":"' +
var url = ef.api_server_url + "?" + encodeURI(
'data=[["SESSIONWEIXINAUTHORIZE",[{"notify_url":"' +
notify_url + '"}]]]') + "&token=" + left_token;
console.log(url);
location.href = url;
@ -503,13 +503,11 @@ import Api from '@/common/api';
request: {
s: [
'APPLICATIONORDERSELFBUYUSERMONEY',
[
{
[{
money_fen: _this.pay_money * 100, //|()
pay_method: 'weixinpay', // weixinpay alipay
weixin_trade_type: 'APP'
}
]
}]
]
},
callback: function(data) {
@ -555,8 +553,7 @@ import Api from '@/common/api';
request: {
s: [
'APPLICATIONORDERSELFBUYUSERMONEY',
[
{
[{
money_fen: _this.pay_money * 100, //|()
// #ifdef MP-WEIXIN
weixin_login_code: _this.code,
@ -568,8 +565,7 @@ import Api from '@/common/api';
pay_method: 'weixinpay', // weixinpay alipay
weixin_trade_type: 'APP'
// #endif
}
]
}]
]
},
callback: function(data) {
@ -692,11 +688,9 @@ import Api from '@/common/api';
request: {
s: [
'APPLICATIONORDERSELFPAYSTATE',
[
{
[{
order_id: order_id
}
]
}]
]
},
callback: function(data) {
@ -715,12 +709,12 @@ import Api from '@/common/api';
});
},
gominxi(){
gominxi() {
uni.navigateTo({
url: '../../pagesU/user/balance'
})
},
gopage(){
gopage() {
uni.navigateTo({
url: '../../pagesU/user/myPurse'
})
@ -733,15 +727,17 @@ import Api from '@/common/api';
</script>
<style lang="scss">
.block{
.block {
width: 94%;
padding: 20upx 3%;
.title{
.title {
width: 100%;
font-size: 34upx;
}
.content{
.my{
.content {
.my {
width: 100%;
height: 120upx;
display: flex;
@ -749,46 +745,53 @@ import Api from '@/common/api';
font-size: 30upx;
border-bottom: solid 1upx #eee;
}
.amount{
.amount {
width: 100%;
.list{
.list {
display: flex;
justify-content: space-between;
padding: 20upx 0;
.box{
.box {
width: 30%;
height: 120upx;
display: flex;
justify-content: center;
align-items: center;
border-radius: 10upx;
box-shadow: 0upx 5upx 20upx rgba(0,0,0,0.05);
box-shadow: 0upx 5upx 20upx rgba(0, 0, 0, 0.05);
font-size: 36upx;
background-color: #f1f1f1;
color: 333;
&.on{
&.on {
background-color: $uni-color-success;
color: #fff;
}
}
}
.num{
.num {
margin-top: 10upx;
display: flex;
justify-content: flex-end;
align-items: center;
.text{
.text {
padding-right: 10upx;
font-size: 30upx;
}
.input{
.input {
width: 28.2vw;
border-bottom: solid 2upx #999;
justify-content: flex-end;
align-items: center;
input{
input {
margin: 0 20upx;
height: 60upx;
font-size: 30upx;
@ -799,29 +802,35 @@ import Api from '@/common/api';
}
}
}
.pay-list{
.pay-list {
width: 100%;
border-bottom: solid 1upx #eee;
.row{
.row {
width: 100%;
height: 120upx;
display: flex;
align-items: center;
.left{
width: 100upx;
.left {
flex-shrink: 0;
display: flex;
align-items: center;
image{
image {
width: 80upx;
height: 80upx;
}
}
.center{
.center {
margin-left: 15px;
width: 100%;
font-size: 30upx;
}
.right{
.right {
width: 100upx;
flex-shrink: 0;
display: flex;
@ -831,13 +840,15 @@ import Api from '@/common/api';
}
}
}
.pay{
.pay {
margin-top: 20upx;
width: 100%;
display: flex;
justify-content: center;
flex-wrap: wrap;
.btn{
.btn {
width: 70%;
height: 80upx;
border-radius: 80upx;
@ -846,14 +857,16 @@ import Api from '@/common/api';
align-items: center;
color: #fff;
background-color: $uni-color-success;
box-shadow: 0upx 5upx 10upx rgba(0,0,0,0.2);
box-shadow: 0upx 5upx 10upx rgba(0, 0, 0, 0.2);
}
.btn-tixi{
.btn-tixi {
color: $uni-color-success;
background: #FFFFFF;
border:1upx solid $uni-color-success;
border: 1upx solid $uni-color-success;
}
.tis{
.tis {
margin-top: 10upx;
width: 100%;
font-size: 24upx;
@ -861,7 +874,8 @@ import Api from '@/common/api';
justify-content: center;
align-items: baseline;
color: #999;
.terms{
.terms {
color: #5a9ef7;
}
}

Loading…
Cancel
Save