Commit 43ac37a0 authored by zhangjianguo's avatar zhangjianguo

收货地址 优惠券接口更改 余额页面新增充值详情和余额说明

parent 78577478
<template>
<u-popup :maskCloseAble="maskCloseAble" mode="bottom" :popup="false" v-model="value" length="auto"
:safeAreaInsetBottom="safeAreaInsetBottom" @close="close" z-index="999">
<view class="u-picker-header" @touchmove.stop.prevent="stop" catchtouchmove="stop">
<view class="u-btn-picker u-btn-picker--tips" hover-class="u-opacity"
:hover-stay-time="150" @tap="getResult('cancel')">取消</view>
<view class="u-btn-picker u-btn-picker--primary" hover-class="u-opacity"
:hover-stay-time="150" @touchmove.stop="" @tap.stop="getResult('confirm')">确定</view>
</view>
<view class="u-picker-body">
<picker-view :value="pickVal" @change="bindChange" class="u-picker-view">
<picker-view-column>
<view class="u-column-item" v-for="(item,index) in districtsObj.provinces" :key="index">
<view class="u-line-1">
{{item.Name}}
</view>
</view>
</picker-view-column>
<picker-view-column>
<view class="u-column-item" v-for="(item,index) in districtsObj.cities" :key="index">
<view class="u-line-1">
{{item.Name}}
</view>
</view>
</picker-view-column>
<picker-view-column>
<view class="u-column-item" v-for="(item,index) in districtsObj.areas" :key="index">
<view class="u-line-1">
{{item.Name}}
</view>
</view>
</picker-view-column>
</picker-view>
</view>
</u-popup>
</template>
<script>
import uPopup from './u-popup'
export default {
props: {
safeAreaInsetBottom: {
type: Boolean,
default: false
},
// 是否允许通过点击遮罩关闭Picker
maskCloseAble: {
type: Boolean,
default: true
},
// 通过双向绑定控制组件的弹出与收起
value: {
type: Boolean,
default: false
},
},
data() {
return {
pickVal:[0, 0, 0],
districtsObj: {
provinces: [],
cities: [],
areas: [],
},
province: 0,
city: 0,
area: 0
}
},
watch: {
// 如果地区发生变化,为了让picker联动起来,必须重置this.citys和this.areas
province(val) {
this.loadCities(this.districtsObj.provinces[this.province].ID);
},
city(val) {
this.loadAreas(this.districtsObj.cities[this.city].ID);
}
},
mounted() {
this.loadDistrict()
},
methods: {
close() {
this.$emit('input', false);
},
async loadDistrict() {
this.loadProvinces()
},
loadProvinces() { // 加载省份
this.request2(
{
url: '/api/Destination/GetChildList',
data: {Id:2}
},
res => {
let data = res.data
this.districtsObj.provinces = data
this.loadCities(data[0].ID)
},
);
},
loadCities(Id) {
this.request2(
{
url: '/api/Destination/GetChildList',
data: {Id:Id}
},
res => {
let data = res.data
this.districtsObj.cities = data
this.loadAreas(data[0].ID)
},
);
},
loadAreas(Id) {
this.request2(
{
url: '/api/Destination/GetChildList',
data: {Id:Id}
},
res => {
let data = res.data
this.districtsObj.areas = data
},
);
},
bindChange(event) {
this.pickVal = event.detail.value;
let i = 0;
this.province = this.pickVal[i++];
this.city = this.pickVal[i++];
this.area = this.pickVal[i++];
},
getResult(event = null) {
let result = {
province: this.districtsObj.provinces[this.province],
city: this.districtsObj.cities[this.city],
area: this.districtsObj.areas[this.area],
}
if (event) this.$emit(event, result);
this.close();
}
},
components:{
uPopup
}
}
</script>
<style lang="scss" scoped>
.u-datetime-picker {
position: relative;
z-index: 999;
}
.u-picker-view {
height: 100%;
box-sizing: border-box;
}
.u-picker-header {
width: 100%;
height: 90rpx;
padding: 0 40rpx;
display: flex;
justify-content: space-between;
align-items: center;
box-sizing: border-box;
font-size: 32rpx;
background: #ddd;
position: relative;
}
.u-picker-header::after {
content: '';
position: absolute;
border-bottom: 1rpx solid #eaeef1;
-webkit-transform: scaleY(0.5);
transform: scaleY(0.5);
bottom: 0;
right: 0;
left: 0;
}
.u-picker-body {
width: 100%;
height: 500rpx;
overflow: hidden;
background-color: #fff;
}
.u-column-item {
display: flex;
align-items: center;
justify-content: center;
font-size: 32rpx;
padding: 0 8rpx;
}
.u-text {
font-size: 24rpx;
padding-left: 8rpx;
}
.u-btn-picker {
padding: 16rpx;
box-sizing: border-box;
text-align: center;
text-decoration: none;
}
.u-opacity {
opacity: 0.5;
}
.u-btn-picker--primary {
}
.u-btn-picker--tips {
}
</style>
<template>
<view class="u-mask" :style="[maskStyle]" :class="[show ? 'u-mask-show' : '']" @tap="click" @touchmove.stop.prevent>
<slot />
</view>
</template>
<script>
/**
* mask 遮罩
* @description 创建一个遮罩层,用于强调特定的页面元素,并阻止用户对遮罩下层的内容进行操作,一般用于弹窗场景
* @tutorial https://www.uviewui.com/components/mask.html
* @property {Boolean} show 是否显示遮罩(默认false)
* @property {String Number} z-index z-index 层级(默认1070)
* @property {Object} custom-style 自定义样式对象,见上方说明
* @property {String Number} duration 动画时长,单位毫秒(默认300)
* @property {Boolean} zoom 是否使用scale对这招进行缩放(默认true)
* @property {Boolean} mask-click-able 遮罩是否可点击,为false时点击不会发送click事件(默认true)
* @event {Function} click mask-click-able为true时,点击遮罩发送此事件
* @example <u-mask :show="show" @click="show = false"></u-mask>
*/
export default {
name: "u-mask",
props: {
// 是否显示遮罩
show: {
type: Boolean,
default: false
},
// 层级z-index
zIndex: {
type: [Number, String],
default: '1'
},
// 用户自定义样式
customStyle: {
type: Object,
default () {
return {}
}
},
// 遮罩的动画样式, 是否使用使用zoom进行scale进行缩放
zoom: {
type: Boolean,
default: true
},
// 遮罩的过渡时间,单位为ms
duration: {
type: [Number, String],
default: 300
},
// 是否可以通过点击遮罩进行关闭
maskClickAble: {
type: Boolean,
default: true
}
},
computed: {
maskStyle() {
let style = {};
style.backgroundColor = "rgba(0, 0, 0, 0.6)";
style.zIndex = this.zIndex ? this.zIndex : this.$u.zIndex.mask;
style.transition = `all ${this.duration / 1000}s ease-in-out`;
// 缩放
if (this.zoom == true) style.transform = 'scale(1.2, 1.2)';
// 判断用户传递的对象是否为空
if (Object.keys(this.customStyle).length) style = { ...style,
...this.customStyle
};
// 合并自定义的样式
//Object.assign(style, customStyle);
return style;
}
},
methods: {
click() {
if (!this.maskClickAble) return;
this.$emit('click');
}
}
}
</script>
<style lang="scss" scoped>
.u-mask {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
opacity: 0;
visibility: hidden;
}
.u-mask-show {
opacity: 1;
visibility: visible;
transform: scale(1);
}
</style>
<template>
<view v-if="visibleSync" :style="[customStyle]" :class="{ 'u-drawer-visible': showDrawer }" class="u-drawer">
<u-mask :maskClickAble="maskCloseAble" :show="showDrawer && mask" @click="maskClick"></u-mask>
<view class="u-drawer-content" @tap="modeCenterClose(mode)" :class="[
safeAreaInsetBottom ? 'safe-area-inset-bottom' : '',
'u-drawer-' + mode,
showDrawer ? 'u-drawer-content-visible' : '',
zoom && mode == 'center' ? 'u-animation-zoom' : ''
]"
@touchmove.stop.prevent @tap.stop.prevent :style="[style]">
<view class="u-mode-center-box" @tap.stop.prevent @touchmove.stop.prevent v-if="mode == 'center'" :style="[centerStyle]">
<slot />
</view>
<block v-else>
<slot />
</block>
</view>
</view>
</template>
<script>
/**
* popup 弹窗
* @description 弹出层容器,用于展示弹窗、信息提示等内容,支持上、下、左、右和中部弹出。组件只提供容器,内部内容由用户自定义
* @tutorial https://www.uviewui.com/components/popup.html
* @property {String} mode 弹出方向(默认left)
* @property {Boolean} mask 是否显示遮罩(默认true)
* @property {String Number} length mode=left | 见官网说明(默认auto)
* @property {Boolean} zoom 是否开启缩放动画,只在mode为center时有效(默认true)
* @property {Boolean} safe-area-inset-bottom 是否开启底部安全区适配(默认false)
* @property {Boolean} mask-close-able 点击遮罩是否可以关闭弹出层(默认true)
* @property {Object} custom-style 用户自定义样式
* @property {Number String} border-radius 弹窗圆角值(默认0)
* @property {Number String} z-index 弹出内容的z-index值(默认1075)
* @event {Function} open 弹出层打开
* @event {Function} close 弹出层收起
* @example <u-popup v-model="show"><view>出淤泥而不染,濯清涟而不妖</view></u-popup>
*/
import uMask from './u-mask'
export default {
name: 'u-popup',
props: {
/**
* 显示状态
*/
show: {
type: Boolean,
default: false
},
/**
* 弹出方向,left|right|top|bottom|center
*/
mode: {
type: String,
default: 'left'
},
/**
* 是否显示遮罩
*/
mask: {
type: Boolean,
default: true
},
// 抽屉的宽度(mode=left|right),或者高度(mode=top|bottom),单位rpx,或者"auto"
// 或者百分比"50%",表示由内容撑开高度或者宽度
length: {
type: [Number, String],
default: 'auto'
},
// 是否开启缩放动画,只在mode=center时有效
zoom: {
type: Boolean,
default: true
},
// 是否开启底部安全区适配,开启的话,会在iPhoneX机型底部添加一定的内边距
safeAreaInsetBottom: {
type: Boolean,
default: false
},
// 是否可以通过点击遮罩进行关闭
maskCloseAble: {
type: Boolean,
default: true
},
// 用户自定义样式
customStyle: {
type: Object,
default () {
return {};
}
},
value: {
type: Boolean,
default: false
},
// 此为内部参数,不在文档对外使用,为了解决Picker和keyboard等融合了弹窗的组件
// 对v-model双向绑定多层调用造成报错不能修改props值的问题
popup: {
type: Boolean,
default: true
},
// 显示显示弹窗的圆角,单位rpx
borderRadius: {
type: [Number, String],
default: 0
},
zIndex: {
type: [Number, String],
default: '100'
}
},
data() {
return {
visibleSync: false,
showDrawer: false,
timer: null,
style1: {}
};
},
computed: {
// 根据mode的位置,设定其弹窗的宽度(mode = left|right),或者高度(mode = top|bottom)
style() {
let style = {};
let translate = '100%';
// 判断是否是否百分比或者auto值,是的话,直接使用该值,否则默认为rpx单位的数值
let length = (/%$/.test(this.length) || this.length == 'auto') ? this.length : uni.upx2px(this.length) + 'px';
// 如果是左边或者上边弹出时,需要给translate设置为负值,用于隐藏
if (this.mode == 'left' || this.mode == 'top') translate = length == 'auto' ? '-100%' : '-' + length;
if (this.mode == 'left' || this.mode == 'right') {
style = {
width: length,
height: '100%',
transform: `translate3D(${translate},0px,0px)`
};
} else if (this.mode == 'top' || this.mode == 'bottom') {
style = {
width: '100%',
height: length,
transform: `translate3D(0px,${translate},0px)`
};
}
style.zIndex = this.zIndex ? this.zIndex : this.$u.zIndex.popup;
// 如果用户设置了borderRadius值,添加弹窗的圆角
if (this.borderRadius) {
switch (this.mode) {
case 'left':
style.borderRadius = `0 ${this.borderRadius}rpx ${this.borderRadius}rpx 0`;
break;
case 'top':
style.borderRadius = `0 0 ${this.borderRadius}rpx ${this.borderRadius}rpx`;
break;
case 'right':
style.borderRadius = `${this.borderRadius}rpx 0 0 ${this.borderRadius}rpx`;
break;
case 'bottom':
style.borderRadius = `${this.borderRadius}rpx ${this.borderRadius}rpx 0 0`;
break;
default:
;
}
// 不加可能圆角无效
style.overflow = 'hidden';
}
return style;
},
// 中部弹窗的特有样式
centerStyle() {
let style = {};
let length = (/%$/.test(this.length) || this.length == 'auto') ? this.length : uni.upx2px(this.length) + 'px';
style.width = length;
style.zIndex = this.zIndex ? this.zIndex : this.$u.zIndex.popup;
if (this.borderRadius) {
style.borderRadius = `${this.borderRadius}rpx`;
// 不加可能圆角无效
style.overflow = 'hidden';
}
return style;
}
},
watch: {
value(val) {
if (val) {
this.open();
} else {
this.close();
}
}
},
created() {
// 先让弹窗组件渲染,再改变遮罩和抽屉元素的样式,让其动画其起作用(必须要有延时,才会有效果)
this.visibleSync = this.value;
setTimeout(() => {
this.showDrawer = this.value;
}, 30);
},
methods: {
// 遮罩被点击
maskClick() {
this.close();
},
close() {
this.change('showDrawer', 'visibleSync', false);
},
// 中部弹出时,需要.u-drawer-content将居中内容,此元素会铺满屏幕,点击需要关闭弹窗
// 让其只在mode=center时起作用
modeCenterClose(mode) {
if (mode != 'center' || !this.maskCloseAble) return;
this.close();
},
open() {
this.change('visibleSync', 'showDrawer', true);
},
// 此处的原理是,关闭时先通过动画隐藏弹窗和遮罩,再移除整个组件
// 打开时,先渲染组件,延时一定时间再让遮罩和弹窗的动画起作用
change(param1, param2, status) {
// 如果this.popup为false,以为着为picker,actionsheet等组件调用了popup组件
if (this.popup == true) this.$emit('input', status);
this[param1] = status;
if (this.timer) {
clearTimeout(this.timer);
}
this.timer = setTimeout(
() => {
this[param2] = status;
this.$emit(status ? 'open' : 'close');
},
status ? 30 : 300
);
}
},
components:{
uMask
}
};
</script>
<style scoped lang="scss">
.u-drawer {
/* #ifndef APP-NVUE */
display: block;
/* #endif */
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
overflow: hidden;
z-index: 999;
background-color: rgba(0, 0, 0, 0.4);
}
.u-drawer-content {
/* #ifndef APP-NVUE */
display: block;
/* #endif */
position: absolute;
z-index: 1003;
transition: all 0.25s linear;
}
.u-drawer-left {
top: 0;
bottom: 0;
left: 0;
background-color: #ffffff;
}
.u-drawer-right {
right: 0;
top: 0;
bottom: 0;
background-color: #ffffff;
}
.u-drawer-top {
top: 0;
left: 0;
right: 0;
background-color: #ffffff;
}
.u-drawer-bottom {
bottom: 0;
left: 0;
right: 0;
background-color: #ffffff;
}
.u-drawer-center {
/* #ifndef APP-NVUE */
display: flex;
flex-direction: column;
/* #endif */
bottom: 0;
left: 0;
right: 0;
top: 0;
justify-content: center;
align-items: center;
opacity: 0;
z-index: 99999;
}
.u-mode-center-box {
min-width: 100rpx;
min-height: 100rpx;
/* #ifndef APP-NVUE */
display: block;
/* #endif */
position: relative;
background-color: #ffffff;
}
.u-drawer-content-visible.u-drawer-center {
transform: scale(1);
opacity: 1;
}
.u-animation-zoom {
transform: scale(1.15);
}
.u-drawer-content-visible {
transform: translate3D(0px, 0px, 0px) !important;
}
.u-drawer-mask {
/* #ifndef APP-NVUE */
display: block;
/* #endif */
opacity: 0;
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
background-color: rgba(0, 0, 0, 0.4);
transition: opacity 0.25s;
}
.u-drawer-mask-visible {
/* #ifndef APP-NVUE */
display: block;
/* #endif */
opacity: 1;
}
</style>
<template> <template>
<view class="AddaddressStyle" :style="{'height':contentHeight}"> <view class="AddaddressStyle" :style="{'height':contentHeight}">
<view class="top"> <!-- <view class="top">
<input class="uni-input" placeholder="自动获得焦点" style="width: 70%;"/> <input class="uni-input" placeholder="自动获得焦点" style="width: 70%;"/>
<view style="display: flex;align-items: center;justify-content: center;border: 1px solid #F4AAA6;width:160rpx ;height: 60rpx;"> <view style="display: flex;align-items: center;justify-content: center;border: 1px solid #F4AAA6;width:160rpx ;height: 60rpx;">
<Text style='color: #EA5A22;'>自动识别</Text> <Text style='color: #EA5A22;'>自动识别</Text>
</view> </view>
</view> </view> -->
<view class="addcenter"> <view class="addcenter">
<view class="addcenter_item2"> <view class="addcenter_item2">
<Text>收货人</Text> <Text>收货人</Text>
<input class="uni-input inputM" v-model="msg.name" /> <input class="uni-input inputM" v-model="msg.Name" />
</view> </view>
<view style="width: 100%;height: 1px;background: #f5f5f5;"/> <view style="width: 100%;height: 1px;background: #f5f5f5;"/>
<view class="addcenter_item2"> <view class="addcenter_item2">
<Text>联系电话</Text> <Text>联系电话</Text>
<input class="uni-input inputM" v-model="msg.mobile" /> <input class="uni-input inputM" v-model="msg.Mobile" />
</view> </view>
<view style="width: 100%;height: 1px;background: #f5f5f5;"/> <view style="width: 100%;height: 1px;background: #f5f5f5;"/>
<!-- TODO 动态获取地址数据 --> <!-- TODO 动态获取地址数据 -->
<view class="addcenter_item"> <view class="addcenter_item">
<Text>所在地区</Text> <Text>所在地区</Text>
<view style="display: flex;flex-direction: row;align-items: center;" @click="Pickershwo=true"> <view style="display: flex;flex-direction: row;align-items: center;" @click="addressShow = true">
<Text :style="{'color':address!=''? '#303133':'#9D9C9B'}">{{address!=''? address :'请选择'}}</Text> <Text :style="{'color':address!=''? '#303133':'#9D9C9B'}">{{address!=''? address :'请选择'}}</Text>
<u-icon name="arrow" color="#B2B2B2" size="30" ></u-icon> <u-icon name="arrow" color="#B2B2B2" size="30" ></u-icon>
<pickerAddress v-model="addressShow" @confirm="addresspick" />
</view> </view>
</view> </view>
<view style="width: 100%;height: 1px;background: #f5f5f5;"/> <view style="width: 100%;height: 1px;background: #f5f5f5;"/>
<!-- TODO 定位地址 --> <!-- TODO 定位地址 -->
<view class="addcenter_item"> <!-- <view class="addcenter_item">
<Text>定位地址</Text> <Text>定位地址</Text>
<view style="display: flex;flex-direction: row;align-items: center;"> <view style="display: flex;flex-direction: row;align-items: center;">
<Text style='#303133'>{{msg.address}}</Text> <Text style='#303133'>{{msg.address}}</Text>
<u-icon name="arrow" color="#B2B2B2" size="30" ></u-icon> <u-icon name="arrow" color="#B2B2B2" size="30" ></u-icon>
</view> </view>
</view> </view> -->
<view style="width: 100%;height: 1px;background: #f5f5f5;"/> <view style="width: 100%;height: 1px;background: #f5f5f5;"/>
<view class="addcenter_item2"> <view class="addcenter_item2">
<Text>详细地址</Text> <Text>详细地址</Text>
<input class="uni-input inputM" v-model="msg.detail" /> <input class="uni-input inputM" v-model="msg.Address" />
</view> </view>
</view> </view>
<view class="btn" @click="preserve" :style="{'background':mainColor}"> <view class="btn" @click="preserve" :style="{'background':mainColor}">
<Text>保存地址</Text> <Text>保存地址</Text>
</view> </view>
<u-picker v-model="Pickershwo" mode="region" @confirm = 'confirm'></u-picker>
<u-toast ref="uToast" /> <u-toast ref="uToast" />
</view> </view>
</template> </template>
<script> <script>
import pickerAddress from '@/components/liudx-pickerAddress/index.vue'
export default { export default {
components: {
pickerAddress
},
data(){ data(){
return{ return{
pageTitle:'收货地址', pageTitle:'收货地址',
contentHeight:0, contentHeight:0,
mainColor:'', mainColor:'',
msg:{ msg:{
location:'', Id:0,
latitude:'', Name:'',
longitude:'', Mobile:'',
id:0, Province:'',
name:'', City:'',
mobile:'', District:'',
address:'', Address:'',
province_id:'2',
city_id:'3',
district_id:'4',
detail:'',
}, },
address:'', address:'',
Pickershwo:false Pickershwo:false,
addressShow: false,
} }
}, },
created(){ created(){
...@@ -81,39 +85,21 @@ ...@@ -81,39 +85,21 @@
}); });
}, },
onLoad: function (option) { //option为object类型,会序列化上个页面传递的参数 onLoad: function (option) { //option为object类型,会序列化上个页面传递的参数
if(option.u!=undefined){ if(option.AddressId!=undefined){
let u = JSON.parse(decodeURIComponent(option.u)) this.getAddressInfo(option.AddressId)
this.msg=u;
this.address = u.province+','+u.city+','+u.district;
} }
}, },
methods:{ methods:{
preserve(){ preserve(){
let pages = getCurrentPages(); // 当前页面 let pages = getCurrentPages(); // 当前页面
let beforePage = pages[pages.length - 2]; // 前一个页面 let beforePage = pages[pages.length - 2]; // 前一个页面
uni.showNavigationBarLoading(); uni.showNavigationBarLoading();
let h = this.apiheader(); this.request2(
h['content-type']='application/x-www-form-urlencoded'
this.request(
{ {
url: "", url: '/api/AppletUser/SetUserShippingAddress',
method: "POST", data: this.msg
header: h,
data: {
r: "api/user/address-save",
location:this.msg.location,
latitude:this.msg.latitude,
longitude:this.msg.longitude,
id:this.msg.id,
name:this.msg.name,
mobile:this.msg.mobile,
address:this.msg.address,
province_id:this.msg.province_id,
city_id:this.msg.city_id,
district_id:this.msg.district_id,
detail:this.msg.detail,
}
}, },
res => { res => {
...@@ -133,13 +119,47 @@ ...@@ -133,13 +119,47 @@
); );
}, },
confirm(e){ getAddressInfo(id){ //获取详细地址接口
console.log(e) uni.showNavigationBarLoading();
this.address = e.province.label+','+e.city.label+','+e.area.label; this.request2(
this.msg.province_id = e.province.value; {
this.msg.city_id = e.city.value; url: '/api/AppletUser/GetUserShippingAddressInfo',
this.msg.district_id = e.area.value; data: {
} AddressId:id
}
},
res => {
uni.hideNavigationBarLoading();
this.msg.Id =res.data.Id;
this.msg.Name =res.data.Name;
this.msg.Mobile =res.data.Mobile;
this.msg.Province =res.data.Province;
this.msg.City =res.data.City;
this.msg.District =res.data.District;
this.msg.Address =res.data.Address;
this.address = res.data.DistrictAddress.split(" ").join(",");
},
);
},
addresspick(obj) {
console.log(obj)
this.msg.Province = obj.province.ID;
this.msg.City = obj.city.ID;
if(obj.area!=undefined){
this.msg.District = obj.area.ID;
this.address = obj.province.Name+','+obj.city.Name+','+obj.area.Name;
}else{
this.msg.District = '';
this.address = obj.province.Name+','+obj.city.Name
}
},
} }
} }
</script> </script>
...@@ -157,7 +177,7 @@ ...@@ -157,7 +177,7 @@
background: #fff; background: #fff;
} }
.AddaddressStyle .addcenter{ .AddaddressStyle .addcenter{
margin-top: 40rpx; /* margin-top: 40rpx; */
background: #FFFFFF; background: #FFFFFF;
} }
.AddaddressStyle .addcenter_item{ .AddaddressStyle .addcenter_item{
...@@ -179,6 +199,7 @@ ...@@ -179,6 +199,7 @@
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
justify-content: space-between;
} }
.AddaddressStyle .btn{ .AddaddressStyle .btn{
...@@ -196,5 +217,6 @@ ...@@ -196,5 +217,6 @@
.AddaddressStyle .inputM{ .AddaddressStyle .inputM{
margin-left: 20rpx; margin-left: 20rpx;
width: 70%; width: 70%;
text-align: right;
} }
</style> </style>
...@@ -8,17 +8,17 @@ ...@@ -8,17 +8,17 @@
> >
<view v-for="(item, index) in list" :key="index" class="addresbox"> <view v-for="(item, index) in list" :key="index" class="addresbox">
<view class="addresclo"> <view class="addresclo">
<Text >收件人:{{item.name}}</Text> <Text >收件人:{{item.Name}}</Text>
<Text>{{item.mobile}}</Text> <Text>{{item.Mobile}}</Text>
</view> </view>
<Text style='width: 100%;'>收货地址:{{item.address}}</Text> <Text style='width: 100%;'>收货地址:{{item.DistrictAddress}}{{item.Address}}</Text>
<view style="width: 100%;height: 2rpx;background: #f5f5f5;margin-top: 15rpx;"></view> <view style="width: 100%;height: 2rpx;background: #f5f5f5;margin-top: 15rpx;"></view>
<view class="addresclo"> <view class="addresclo">
<u-checkbox-group @change="isdefault(item)"> <u-checkbox-group @change="isdefault(item)">
<u-checkbox v-model="item.is_default==1?true:false" shape="circle" :active-color="mainColor"> <u-checkbox v-model="item.IsDefault==1?true:false" shape="circle" :active-color="mainColor">
<Text <Text
:style="{'color':item.is_default==1?mainColor:'#c8c9cc' }" :style="{'color':item.IsDefault==1?mainColor:'#c8c9cc' }"
>{{item.is_default==1?'已设为默认':'设为默认'}}</Text> >{{item.IsDefault==1?'已设为默认':'设为默认'}}</Text>
</u-checkbox> </u-checkbox>
</u-checkbox-group> </u-checkbox-group>
<view style="display: flex;flex-direction: row;align-items: center;"> <view style="display: flex;flex-direction: row;align-items: center;">
...@@ -125,7 +125,7 @@ export default { ...@@ -125,7 +125,7 @@ export default {
init() { init() {
this.loading = false; this.loading = false;
uni.showNavigationBarLoading(); uni.showNavigationBarLoading();
let h = this.apiheader();
this.request2( this.request2(
{ {
url: '/api/AppletUser/GetUserShippingAddressList', url: '/api/AppletUser/GetUserShippingAddressList',
...@@ -133,49 +133,27 @@ export default { ...@@ -133,49 +133,27 @@ export default {
}, },
res => { res => {
uni.hideNavigationBarLoading(); uni.hideNavigationBarLoading();
console.log("res",res);
if(res.resultCode==1){ if(res.resultCode==1){
this.isloading = false; this.isloading = false;
this.list = res.data.list; this.list = res.data;
} }
} }
); );
// this.request(
// {
// url: "",
// header: h,
// data: {
// r: "api/user/address"
// }
// },
// res => {
// uni.hideNavigationBarLoading();
// this.isloading = false;
// this.list = res.data.list;
// }
// );
}, },
reloadUserinfo() { reloadUserinfo() {
this.u = uni.getStorageSync("userinfo"); this.u = uni.getStorageSync("userinfo");
this.showAuth = false; this.showAuth = false;
}, },
isdefault(item) { isdefault(item) {
//默认地址 //设置默认地址
uni.showNavigationBarLoading(); uni.showNavigationBarLoading();
let h = this.apiheader(); this.request2(
h['content-type']='application/x-www-form-urlencoded'
this.request(
{ {
url: "", url: '/api/AppletUser/SetUserShippingAddressDefault',
method: "POST", data: {
header: h, AddressId:item.Id
data: { }
r: "api/user/address-default",
id: item.id,
is_default: item.is_default == 1 ? 0 : 1
}
}, },
res => { res => {
...@@ -186,25 +164,21 @@ export default { ...@@ -186,25 +164,21 @@ export default {
}, },
btn_edit(item) { btn_edit(item) {
uni.navigateTo({ uni.navigateTo({
url: "/pages/address/AddAddress?u=" + encodeURIComponent(JSON.stringify(item)) url: "/pages/address/AddAddress?AddressId="+item.Id
}); });
}, },
btn_delete(item) { btn_delete(item) {
this.deleteID = item.id; this.deleteID = item.Id;
this.showModal = true; this.showModal = true;
}, },
confirm() { confirm() {
uni.showNavigationBarLoading(); uni.showNavigationBarLoading();
let h = this.apiheader(); this.request2(
h['content-type']='application/x-www-form-urlencoded'
this.request(
{ {
url: "", url: "/api/AppletUser/DelUserShippingAddress",
method: "POST",
header: h,
data: { data: {
r: "api/user/address-destroy", AddressId:this.deleteID
id: this.deleteID
} }
}, },
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<Text style='color: #fff;;font-size: 28rpx;'>充值</Text> <Text style='color: #fff;;font-size: 28rpx;'>充值</Text>
</view> </view>
<!-- TODO 暂无余额说明 --> <!-- TODO 暂无余额说明 -->
<u-icon name="question-o" color="#fff" class='explain' size="36"></u-icon> <u-icon name="question-o" color="#fff" class='explain' size="36" @click="goUrl('/pages/balance/rules')"></u-icon>
</view> </view>
<view class="timechoice"> <view class="timechoice">
<view style="width: 50%;display: flex;flex-direction: row;align-items: center;justify-content: space-between;"> <view style="width: 50%;display: flex;flex-direction: row;align-items: center;justify-content: space-between;">
...@@ -16,11 +16,37 @@ ...@@ -16,11 +16,37 @@
<u-icon name="arrow" color="#909399" size="36" @click='fun_date(1)'></u-icon> <u-icon name="arrow" color="#909399" size="36" @click='fun_date(1)'></u-icon>
</view> </view>
</view> </view>
<view> <view v-if="logsList.length > 0"
<!-- TODO logs列表 --> style="
height: calc(100vh - 265px);
width: calc(100vw);
overflow: hidden;
padding-top: 10px;
">
<scroll-view
:scroll-y="true"
:enable-back-to-top="true"
:enable-flex="true"
@scrolltolower="lower"
:style="{ height: '100%' }">
<view style="display: flex;flex-direction: column;align-items: center;">
<view v-for="(item, index) in logsList" :key="index" class='logsList' @click="godetail(item.id)">
<view class="logsList_l">
<Text class='l_name'>{{item.desc}}</Text>
<Text style='font-size: 13px;color: #666;'>{{item.created_at}}</Text>
</view>
<view class="logsList_r">
<Text :style="{color:item.type==1 ? mainColor:'#6ABE60'}">{{item.type==1 ? '+':'-'}}{{item.money}}</Text>
</view>
</view>
</view>
</scroll-view>
</view> </view>
<auth v-if="showAuth" @changeuserinfo="reloadUserinfo"></auth> <!-- <auth v-if="showAuth" @changeuserinfo="reloadUserinfo"></auth> -->
<view class="loading" v-if="load"> <view class="loading" v-if="load">
<u-loading mode="flower" size="48"></u-loading> <u-loading mode="flower" size="48"></u-loading>
<Text style='color: #fff;margin-top: 10rpx;'>加载中...</Text> <Text style='color: #fff;margin-top: 10rpx;'>加载中...</Text>
...@@ -126,7 +152,7 @@ ...@@ -126,7 +152,7 @@
}, },
res => { res => {
this.load=false this.load=false
this.logsList = res.data.list
uni.hideNavigationBarLoading() uni.hideNavigationBarLoading()
} }
...@@ -178,6 +204,11 @@ ...@@ -178,6 +204,11 @@
url: url url: url
}) })
}, },
godetail(id){
uni.navigateTo({
url: '/pages/balance/detail?id='+id
})
}
} }
} }
</script> </script>
...@@ -233,4 +264,37 @@ ...@@ -233,4 +264,37 @@
margin-left: -100rpx; margin-left: -100rpx;
z-index: 999; z-index: 999;
} }
.balanceStyle .logsList{
width: 100%;
height: 75px;
background: #fff;
display: flex;
flex-direction: row;
align-items: center;
padding: 10px;
border-top: 1px solid #f5f5f5;
}
.balanceStyle .logsList_l{
width: calc(100vw - 20px - 150px);
height: 55px;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.balanceStyle .logsList_r{
width: 150px;
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-end;
font-size: 26px;
}
.balanceStyle .logsList_l .l_name{
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
font-size: 14px;
}
</style> </style>
<template>
<view class="balancedetailStyle" :style="{'height':contentHeight}" >
<view class="bd_box" style="border-bottom: 1px solid #f5f5f5;">
<view class='bd_box_l'>
<Text>交易金额</Text>
</view>
<Text class='bd_r' :style="{color:g.type==1 ? mainColor:'#6ABE60',}">{{g.type==1 ? '+':'-'}}{{g.money}}</Text>
</view>
<view class="bd_box" >
<view class='bd_box_l'>
<Text>交易时间</Text>
</view>
<Text >{{g.created_at}}</Text>
</view>
<view class="bd_box" style="align-items: flex-start;">
<view class='bd_box_l'>
<Text>交易详情</Text>
</view>
<view style='width: calc(100vw - 20px - 80px);'>
<Text >{{g.desc}}</Text>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
pageTitle:"余额详情",
contentHeight:0,
mainColor: "",
g:{},
}
},
mounted() {
let currentPages = getCurrentPages();
let u = "/" + currentPages[currentPages.length-1].route;
let pages = uni.getStorageSync("basedata")
? uni.getStorageSync("basedata").bar_title
: [];
pages.forEach((x) => {
if (x.value == u) {
this.pageTitle = x.new_name ? x.new_name : x.name;
}
});
uni.setNavigationBarTitle({
title: this.pageTitle,
});
},
onLoad(option){
this.getlogdetail(option.id)
},
created(){
this.contentHeight = this.$utils.calcContentHeight(-40)+'px';
this.mainColor = this.$uiConfig.mainColor;
},
methods: {
getlogdetail(id){
uni.showNavigationBarLoading();
let h=this.apiheader()
this.request(
{
url: "",
header:h,
data: {
r: "api/balance/log-detail",
id:id
}
},
res => {
uni.hideNavigationBarLoading()
this.g = res.data.detail;
}
);
},
}
}
</script>
<style>
.balancedetailStyle{
background: #f3f4f6;
width: 100%;
}
.balancedetailStyle .bd_box{
width: 100%;
background:#fff;
padding: 15px 10px;
display: flex;
flex-direction: row;
align-items: center;
}
.bd_box .bd_box_l{
color: #999999;
margin-right: 10px;
width: 70px;
display: inline-block;
}
.bd_box .bd_r{
font-size: 20px;
}
</style>
...@@ -30,29 +30,21 @@ ...@@ -30,29 +30,21 @@
</view> </view>
</view> </view>
<!-- <auth v-if="showAuth" @changeuserinfo="reloadUserinfo"></auth> -->
</view> </view>
</template> </template>
<script> <script>
import auth from "../../components/auth/index.vue";
export default { export default {
data() { data() {
return { return {
pageTitle:"充值中心", pageTitle:"充值中心",
showAuth:false,
contentHeight:0, contentHeight:0,
mainColor: "", mainColor: "",
u:{},
g:{}, g:{},
} }
}, },
components:{
auth
},
mounted() { mounted() {
let currentPages = getCurrentPages(); let currentPages = getCurrentPages();
let u = "/" + currentPages[currentPages.length-1].route; let u = "/" + currentPages[currentPages.length-1].route;
...@@ -69,28 +61,18 @@ ...@@ -69,28 +61,18 @@
}); });
}, },
onLoad(){ onLoad(){
this.u = uni.getStorageSync("userinfo");
if (!this.u) {
this.u = {
nickName: "未登录",
avatarUrl: ""
};
this.showAuth = true;
}
}, },
created(){ created(){
this.contentHeight = this.$utils.calcContentHeight(-40)+'px'; this.contentHeight = this.$utils.calcContentHeight(-40)+'px';
this.mainColor = this.$uiConfig.mainColor; this.mainColor = this.$uiConfig.mainColor;
this.balancedata() this.balancedata()
this.getrecharge() //充值金额的列表
}, },
methods: { methods: {
reloadUserinfo() {
this.u = uni.getStorageSync("userinfo");
this.showAuth=false
},
balancedata(){ balancedata(){
uni.showNavigationBarLoading(); uni.showNavigationBarLoading();
let h=this.apiheader() let h=this.apiheader()
...@@ -109,27 +91,8 @@ ...@@ -109,27 +91,8 @@
} }
); );
}, },
getlogs(){
uni.showNavigationBarLoading();
let h=this.apiheader()
this.request(
{
url: "",
header:h,
data: {
r: "api/recharge/index",
date:this.date2,
}
},
res => {
uni.hideNavigationBarLoading()
}
);
},
btn_recharge(){ btn_recharge(){
}, },
......
<template>
<view class="balancerulesStyle" :style="{'height':contentHeight}" >
<view class="rulesbox">
<Text>暂无余额说明</Text>
</view>
</view>
</template>
<script>
export default {
data() {
return {
pageTitle:"余额说明",
contentHeight:0,
mainColor: "",
g:{},
}
},
mounted() {
let currentPages = getCurrentPages();
let u = "/" + currentPages[currentPages.length-1].route;
let pages = uni.getStorageSync("basedata")
? uni.getStorageSync("basedata").bar_title
: [];
pages.forEach((x) => {
if (x.value == u) {
this.pageTitle = x.new_name ? x.new_name : x.name;
}
});
uni.setNavigationBarTitle({
title: this.pageTitle,
});
},
created(){
this.contentHeight = this.$utils.calcContentHeight(-40)+'px';
this.mainColor = this.$uiConfig.mainColor;
},
methods: {
}
}
</script>
<style>
.balancerulesStyle{
background: #fff;
width: 100%;
}
.rulesbox{
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
</style>
...@@ -2,26 +2,26 @@ ...@@ -2,26 +2,26 @@
<view class="coupondetailsStyle" :style="{ height: contentHeight }"> <view class="coupondetailsStyle" :style="{ height: contentHeight }">
<view class="cd_box"> <view class="cd_box">
<Text class='cd_name'> <Text class='cd_name'>
{{g.name}} {{g.Name}}
</Text> </Text>
<!-- <Text class='sub_price'> <!-- <Text class='sub_price'>
{{g.sub_price}} {{g.sub_price}}
</Text> --> </Text> -->
<view style="display: flex;align-items: flex-end;"> <view style="display: flex;align-items: flex-end;">
<Text style='font-size: 32px;'>{{g.type==1?Number(g.discount): Number(g.sub_price)}} </Text> <Text style='font-size: 32px;'>{{ g.DiscountsPrice }} </Text>
<Text style='font-size: 14px;'>{{g.type==1?'折':""}}</Text> <Text style='font-size: 14px;'>{{g.CouponType==2?'折':""}}</Text>
</view> </view>
<Text class='condition'> <Text class='condition'>
{{Number(g.min_price) }}可用 {{g.MinConsumePrice }}可用
</Text> </Text>
<Text v-if='g.type==1'>优惠上限:¥{{Number(g.discount_limit) }}</Text> <!-- <Text v-if='g.type==1'>优惠上限:¥{{Number(g.MaxDiscountsPrice) }}</Text> -->
<view v-if='type==2' class="receive" :style="{'background':mainColor}" @click="receive(g.id)"> <view v-if='type==2 && g.IsReceive==0' class="receive" :style="{'background':mainColor}" @click="receive(g.CouponId)">
<Text> <Text>
立即领取 立即领取
</Text> </Text>
</view> </view>
<view v-if='type==1' class="gouse" @click="gouseUrl(g.page_url)"> <view v-if='type==1 || g.IsReceive==1' class="gouse" @click="gouseUrl(g)">
<Text> <Text>
去使用 去使用
</Text> </Text>
...@@ -29,17 +29,17 @@ ...@@ -29,17 +29,17 @@
<view style="width: 100%;border-top: 1px dashed #f5f5f5;margin: 10px 0;"></view> <view style="width: 100%;border-top: 1px dashed #f5f5f5;margin: 10px 0;"></view>
<Text class='c_name' style='margin-top: 25px;'>有效期</Text> <Text class='c_name' style='margin-top: 25px;'>有效期</Text>
<Text class='cd_content' v-if='g.expire_type==1'>领取后{{g.expire_day}}天内有效</Text> <!-- <Text class='cd_content' v-if='g.expire_type==1'>领取后{{g.expire_day}}天内有效</Text>
<Text class='cd_content' v-if='g.expire_type==2'>{{g.begin_time}}-{{g.end_time}}</Text> <Text class='cd_content' v-if='g.expire_type==2'>{{g.begin_time}}-{{g.end_time}}</Text> -->
<Text class='cd_content' >{{g.StartDate}}-{{g.EndDate}}</Text>
<Text class='c_name' style='margin-top: 1px;'>使用规则</Text> <Text class='c_name' style='margin-top: 1px;'>使用规则</Text>
<Text class='cd_content' v-if='g.appoint_type==1'>适用类别: <Text v-for="(item, index) in g.goods" :key="index">{{item.name}}</Text> </Text> <Text class='cd_content' v-if='g.UseType==1'>适用类别: <Text v-for="(item, index) in g.ProductList" :key="index">{{item.Relevance}}</Text> </Text>
<Text class='cd_content' v-if='g.appoint_type==2'>适用商品: <Text v-for="(item, index) in g.goods" :key="index">{{item.name}}</Text> </Text> <Text class='cd_content' v-if='g.UseType==2'>适用商品: <Text v-for="(item, index) in g.ProductList" :key="index">{{item.Relevance}}</Text> </Text>
<Text class='cd_content' v-if='g.appoint_type==3'>适用范围:全场通用</Text> <Text class='cd_content' v-if='g.UseType==3'>适用范围:全场通用</Text>
<Text class='cd_content' v-if='g.appoint_type==4'>适用方式:当面付</Text> <Text class='cd_content' v-if='g.UseType==4'>适用方式:当面付</Text>
<Text class='c_name' style='margin-top: 1px;'>使用说明</Text> <Text class='c_name' style='margin-top: 1px;'>使用说明</Text>
<Text class='cd_content'>{{g.rule}}</Text> <Text class='cd_content'>{{g.Describe}}</Text>
</view> </view>
...@@ -84,33 +84,12 @@ export default { ...@@ -84,33 +84,12 @@ export default {
}, },
onLoad: function (option) { onLoad: function (option) {
this.type = option.type this.type = option.type
if(option.type==1){ //查看自己优惠详情 let item = JSON.parse(decodeURIComponent(option.item))
this.getdetail(option.coupon_id) this.g = item
}else if(option.type==2){//查看领券中心的优惠券
this.init(option.coupon_id);
}
}, },
methods: { methods: {
getdetail(coupon_id) {
uni.showNavigationBarLoading();
let h = this.apiheader();
this.request(
{
url: "",
header: h,
data: {
r: "api/coupon/user-coupon-detail",
user_coupon_id:coupon_id
},
},
(res) => {
this.g = res.data.list
uni.hideNavigationBarLoading();
}
);
},
init(coupon_id) { init(coupon_id) {
uni.showNavigationBarLoading(); uni.showNavigationBarLoading();
let h = this.apiheader(); let h = this.apiheader();
...@@ -130,32 +109,36 @@ export default { ...@@ -130,32 +109,36 @@ export default {
); );
}, },
receive(id){ receive(id){
let h = this.apiheader(); this.request2(
this.request( {
{ url: '/api/AppletUser/GrantCoupon',
url: "", data: {
header: h, CouponId:id
data: { }
r: "api/coupon/receive", },
coupon_id:id
},
},
(res) => { (res) => {
uni.hideNavigationBarLoading(), if(res.resultCode==1){
// this.isreceive = true
this.$refs.uToast.show({ uni.showToast({
title: "领取成功" title: res.message,
}); icon: "none"
uni.navigateTo({ });
url: "/pages/coupon/index/index" this.g.IsReceive=1;
}); }
}
}
); );
}, },
gouseUrl(url){ gouseUrl(g){
uni.redirectTo({ url: url }); let id
if(this.type == 1){
id = g.ID
}else if(this.type == 2){
id = g.CouponId
}
uni.redirectTo({ url: '/pages/goods/list?coupon_id='+ id});
} }
}, },
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<u-tabs <u-tabs
:list="list" :list="list"
:is-scroll="false" :is-scroll="false"
:current="current" :current="msg.UseState"
@change="change" @change="change"
:active-color="mainColor" :active-color="mainColor"
></u-tabs> ></u-tabs>
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
height: calc(100vh - 50px); height: calc(100vh - 50px);
width: calc(100vw); width: calc(100vw);
overflow: hidden; overflow: hidden;
padding-top: 10px;
padding-bottom: 50px; padding-bottom: 50px;
" "
> >
...@@ -27,18 +26,18 @@ ...@@ -27,18 +26,18 @@
:style="{ height: '100%' }" :style="{ height: '100%' }"
> >
<view class="couponList"> <view class="couponList">
<view class="item" v-for="(x, i) in g" :key="i" @click="godetails(x.id)"> <view class="item" v-for="(x, i) in g" :key="i" @click="godetails(x)">
<view :class="current==0? 'ticket':'ticket2'"> <view :class="msg.UseState==0? 'ticket':'ticket2'">
<view class="miane"> <view class="miane">
<view class="money"> <view class="money">
<!-- <text style="font-size: 44px;">{{x.sub_price.toString().split('.')[0]}}</text> <!-- <text style="font-size: 44px;">{{x.sub_price.toString().split('.')[0]}}</text>
<text v-if="x.coupon.type==1"></text> --> <text v-if="x.coupon.type==1"></text> -->
<text class="small" v-if="x.coupon.type==2"></text> <text class="small" v-if="x.CouponType==1"></text>
<Text style='font-size: 44px;'>{{x.type==1?Number(x.discount) :Number(x.sub_price) }} </Text> <Text style='font-size: 44px;'>{{ Number(x.DiscountsPrice) }} </Text>
<Text class="small">{{x.type==1?'折':""}}</Text> <Text class="small">{{x.CouponType==2?'折':""}}</Text>
</view> </view>
<view class="tiaojian">{{Number(x.coupon_min_price)}}元可用</view> <view class="tiaojian">{{Number(x.MinConsumePrice)}}元可用</view>
</view> </view>
<view style='width: 10px;height: 10px;border-radius: 5px;background: #f3f4f6;position: absolute;right: -5px;top:-5px'></view> <view style='width: 10px;height: 10px;border-radius: 5px;background: #f3f4f6;position: absolute;right: -5px;top:-5px'></view>
<view style='width: 10px;height: 10px;border-radius: 5px;background: #f3f4f6;position: absolute;right: -5px;bottom:-5px'></view> <view style='width: 10px;height: 10px;border-radius: 5px;background: #f3f4f6;position: absolute;right: -5px;bottom:-5px'></view>
...@@ -47,25 +46,26 @@ ...@@ -47,25 +46,26 @@
</view> </view>
<view class="detail"> <view class="detail">
<view class="coupond"> <view class="coupond">
<view class="name">{{x.coupon.name}}</view> <view class="name">{{x.Name}}</view>
<view class="date">{{x.start_time+"-"+x.end_time}}</view> <view class="date">{{x.StartDate+"-"+x.EndDate}}</view>
<Text class="rule" v-if='x.coupon.appoint_type==1'>限商品类别</Text> <Text class="rule" v-if='x.UseTypeStr==1'>限商品类别</Text>
<Text class="rule" v-if='x.coupon.appoint_type==2'>限商品</Text> <Text class="rule" v-if='x.UseTypeStr==2'>限商品</Text>
<Text class="rule" v-if='x.coupon.appoint_type==3'>全场通用</Text> <Text class="rule" v-if='x.UseTypeStr==3'>全场通用</Text>
<Text class="rule" v-if='x.coupon.appoint_type==4'>当面付</Text> <Text class="rule" v-if='x.UseTypeStr==4'>当面付</Text>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<u-divider
contentPosition="center" <u-loadmore
v-if="isover" :status="status"
:margin-top="20" :load-text="loadText"
:margin-bottom="20" :font-size="24"
bg-color="#f3f4f6" :margin-top="20"
>没有更多优惠券了</u-divider :margin-bottom="20"
> bg-color="#f3f4f6"
/>
</scroll-view> </scroll-view>
</view> </view>
<view style="width: 100%;height: 50px;background: #FFFFFF;display: flex;align-items: center;justify-content: center;position: absolute;left: 0;bottom: 0;" @click="goUrl"> <view style="width: 100%;height: 50px;background: #FFFFFF;display: flex;align-items: center;justify-content: center;position: absolute;left: 0;bottom: 0;" @click="goUrl">
...@@ -91,7 +91,7 @@ export default { ...@@ -91,7 +91,7 @@ export default {
data() { data() {
return { return {
pageTitle: "我的优惠券", pageTitle: "我的优惠券",
current: 0,
list: [ list: [
{ name: "未使用" }, { name: "未使用" },
{ name: "已使用" }, { name: "已使用" },
...@@ -99,14 +99,21 @@ export default { ...@@ -99,14 +99,21 @@ export default {
], ],
mainColor: "", mainColor: "",
contentHeight: 0, contentHeight: 0,
page: 1,
msg:{
pageIndex: 1,
pageSize:10,
UseState:0
},
page_count: 1, page_count: 1,
g: [], g: [],
loading: false, loading: false,
showModal: false, status: "loadmore",
item: "", loadText: {
index: 0, loadmore: "轻轻上拉,加载更多",
isover: false, loading: "努力加载中",
nomore: "没有更多优惠券了",
},
}; };
}, },
created() { created() {
...@@ -128,59 +135,55 @@ export default { ...@@ -128,59 +135,55 @@ export default {
title: this.pageTitle, title: this.pageTitle,
}); });
}, },
onLoad: function (option) { onLoad: function (option) {
//option为object类型,会序列化上个页面传递的参数
// this.current = option.status;
this.loading = true; this.loading = true;
this.init(); this.init();
}, },
methods: { methods: {
change(index) { change(index) {
console.log(index)
this.current = index; this.msg.UseState = index;
this.page = 1; this.msg.pageIndex = 1;
this.g = []; this.g = [];
this.loading = true; this.loading = true;
this.init(); this.init();
}, },
init() { init() {
this.isover = false;
let h = this.apiheader(); this.request2(
this.request( {
{ url: '/api/AppletUser/GetMemberCouponPageList',
url: "", data: this.msg
header: h, },
data: { res => {
r: "api/coupon/user-coupon", uni.hideNavigationBarLoading();
status: this.current+1, if(res.resultCode==1){
page: this.page,
}, this.loading = false;
}, this.g = this.g.concat(res.data.pageData);
(res) => {
this.loading = false; this.page_count = res.data.pageCount;
if(res.data.list.length>0){ if (this.page_count == 1) {
this.g = this.g.concat(res.data.list); this.status = "nomore";
// TODO 这里没返一共多少页 注意下 }
// this.page_count = res.data.pagination.page_count; }
// if (this.page_count == 1) { }
// this.isover = true; );
// }
}
}
);
}, },
lower(e) { lower(e) {
if (this.page < this.page_count) { if (this.msg.pageIndex < this.page_count) {
this.page++; this.msg.pageIndex++;
this.status = "loading";
this.init(); this.init();
} else { } else {
this.isover = true;
this.status = "nomore";
} }
}, },
godetails(id){ godetails(item){
if(this.current ==0){ if(this.msg.UseState ==0){
uni.navigateTo({ uni.navigateTo({
url: "/pages/coupon/details/details?coupon_id=" +id+'&type=1' url: "/pages/coupon/details/details?item=" + encodeURIComponent(JSON.stringify(item))+'&type=1'
}); });
} }
......
...@@ -19,34 +19,42 @@ ...@@ -19,34 +19,42 @@
:style="{ height: '100%' }" :style="{ height: '100%' }"
> >
<view class="couponlist"> <view class="couponlist">
<view class="c_list_item" v-for="(x, i) in g" :key="i" @click="goUrl(x.id)"> <view class="c_list_item" v-for="(x, i) in g" :key="i" @click="goUrl(x)">
<view class="item_top"> <view class="item_top">
<view class="item_top_l"> <view class="item_top_l">
<view style="display: flex;align-items: flex-end;"> <view style="display: flex;align-items: flex-end;">
<Text style='font-size: 32px;'>{{x.type==1?Number(x.discount): Number(x.sub_price)}} </Text> <Text style='font-size: 32px;'>{{Number(x.DiscountsPrice)}} </Text>
<Text style='font-size: 14px;'>{{x.type==1?'折':""}}</Text> <Text style='font-size: 14px;'>{{x.CouponType==2?'折':""}}</Text>
</view> </view>
<view style="display: flex;flex-direction: column;margin-left: 10px;width: 210px;"> <view style="display: flex;flex-direction: column;margin-left: 10px;width: 210px;">
<Text class='top_title'>{{x.name}}</Text> <Text class='top_title'>{{x.Name}}</Text>
<Text>{{Number(x.min_price) }}可用</Text> <Text>{{Number(x.MinConsumePrice) }}可用</Text>
<Text v-if='x.type==1'>优惠上限:¥{{Number(x.discount_limit) }}</Text> <Text v-if='Number(x.MaxDiscountsPrice)>1'>优惠上限:¥{{Number(x.MaxDiscountsPrice) }}</Text>
</view> </view>
</view> </view>
<view class="receive" @click.stop="receive(x.id)"> <view class="receive" @click.stop="receive(x,i)">
<Text>立即领取</Text> <Text>{{x.IsReceive==1?'已领取':'立即领取'}} </Text>
</view> </view>
</view> </view>
<view class="item_b"> <view class="item_b">
<Text v-if='x.expire_type==1'>领券后{{x.expire_day}}天过期</Text> <Text v-if='x.IndateType==1'>领券后{{x.IndateDay}}天过期</Text>
<Text v-if='x.expire_type==2'>有效日期{{x.begin_time}}-{{x.end_time}}</Text> <Text v-if='x.IndateType==2'>有效日期{{x.StartDate}}-{{x.EndDate}}</Text>
<Text class='top_title' v-if='x.appoint_type==1'>适用类别: <Text v-for="(item, index) in x.goods" :key="index">{{item.name}}</Text> </Text> <!-- <Text class="top_title" >{{x.UseTypeStr}}</Text> -->
<Text class='top_title' v-if='x.appoint_type==2'>适用商品: <Text v-for="(item, index) in x.goods" :key="index">{{item.name}}</Text> </Text> <Text class='top_title' v-if='x.UseType==1'>适用类别: <Text v-for="(item, index) in x.ProductList" :key="index">{{item.Relevance}}</Text> </Text>
<Text class='top_title' v-if='x.appoint_type==3'>适用范围:全场通用</Text> <Text class='top_title' v-if='x.UseType==2'>适用商品: <Text v-for="(item, index) in x.ProductList" :key="index">{{item.Relevance}}</Text> </Text>
<Text class='top_title' v-if='x.appoint_type==4'>适用方式:当面付</Text> <Text class='top_title' v-if='x.UseType==3'>适用范围:全场通用</Text>
<Text class='top_title' v-if='x.UseType==4'>适用方式:当面付</Text>
</view> </view>
</view> </view>
</view> </view>
<u-loadmore
:status="status"
:load-text="loadText"
:font-size="24"
:margin-top="20"
:margin-bottom="20"
bg-color="#f3f4f6"
/>
</scroll-view> </scroll-view>
</view> </view>
...@@ -69,9 +77,17 @@ export default { ...@@ -69,9 +77,17 @@ export default {
contentHeight: 0, contentHeight: 0,
g: [], g: [],
loading: false, loading: false,
msg:{
pageIndex: 1,
pageSize:10,
},
page_count: 1,
status: "loadmore",
loadText: {
loadmore: "轻轻上拉,加载更多",
loading: "努力加载中",
nomore: "没有更多优惠券了",
},
}; };
}, },
created() { created() {
...@@ -102,56 +118,60 @@ export default { ...@@ -102,56 +118,60 @@ export default {
methods: { methods: {
init() { init() {
uni.showNavigationBarLoading();
let h = this.apiheader(); this.request2(
this.request( {
{ url: '/api/AppletUser/GetAllCouponPageList',
url: "", data: this.msg
header: h, },
data: { res => {
r: "api/coupon/list",
}, if(res.resultCode==1){
},
(res) => { this.loading = false;
this.loading = false; this.g = this.g.concat(res.data.pageData);
if(res.data.list.length>0){ this.page_count = res.data.pageCount;
this.g = res.data.list; if (this.page_count == 1) {
} this.status = "nomore";
uni.hideNavigationBarLoading(); }
} }
}
); );
}, },
goUrl(id){ goUrl(item){
uni.navigateTo({ uni.navigateTo({
url: "/pages/coupon/details/details?coupon_id=" +id+'&type=2' url: "/pages/coupon/details/details?item=" + encodeURIComponent(JSON.stringify(item))+'&type=2'
}); });
}, },
receive(id){ receive(x,i){
let h = this.apiheader(); if(x.IsReceive==0){
this.request( this.request2(
{ {
url: "", url: '/api/AppletUser/GrantCoupon',
header: h, data: {
data: { CouponId:x.CouponId
r: "api/coupon/receive", }
coupon_id:id },
},
}, (res) => {
if(res.resultCode==1){
(res) => {
uni.hideNavigationBarLoading(), uni.showToast({
this.$refs.uToast.show({ title: res.message,
title: "领取成功" icon: "none"
}); });
// uni.navigateTo({ this.g[i].IsReceive=1;
// url: "/pages/coupon/index/index" }
// });
}
} );
}else{
); uni.showToast({
title: "已领取过优惠券",
icon: "none"
});
}
} }
}, },
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
</view> </view>
</template> </template>
<!-- <auth v-if="showAuth" @changeuserinfo="reloadUserinfo"></auth> --> <auth v-if="showAuth" @changeuserinfo="reloadUserinfo"></auth>
</view> </view>
</template> </template>
......
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
<Text><Text :style="{color:mainColor}">{{orderdata.order_money}}</Text></Text> <Text><Text :style="{color:mainColor}">{{orderdata.order_money}}</Text></Text>
</view> </view>
<view class="menus_item" @click="goUrl(sharemenus.team.url)"> <view class="menus_item" @click="goUrl(sharemenus.cash.url)">
<image :src="sharemenus.cash.icon" style="width: 30px;" mode='widthFix'></image> <image :src="sharemenus.cash.icon" style="width: 30px;" mode='widthFix'></image>
<Text class='item_text'>{{sharemenus.cash.name}}</Text> <Text class='item_text'>{{sharemenus.cash.name}}</Text>
<Text><Text :style="{color:mainColor}">{{orderdata.total_cash}}</Text></Text> <Text><Text :style="{color:mainColor}">{{orderdata.total_cash}}</Text></Text>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment