first commit
This commit is contained in:
189
pages/code/code.vue
Normal file
189
pages/code/code.vue
Normal file
@ -0,0 +1,189 @@
|
||||
<template>
|
||||
<view class="user-index">
|
||||
<!--礼品卡兑换-->
|
||||
<view class="thbox">
|
||||
<view class="thcontent">
|
||||
<image class="kabg" :src="img" mode="widthFix"></image>
|
||||
<view class="srkbox">
|
||||
<view class="kh">
|
||||
<text class="khtxt">卡号</text>
|
||||
<input class="khsr" v-model="code_no" placeholder="请输入兑换卡号" />
|
||||
</view>
|
||||
<view class="kh">
|
||||
<text class="khtxt">密码</text>
|
||||
<input class="khsr" v-model="code_pwd" placeholder="请输入兑换密码" />
|
||||
</view>
|
||||
</view>
|
||||
<button class="qubtn" @click="confirm">确认兑换</button>
|
||||
</view>
|
||||
<view class="wbtxt">
|
||||
<text class="dhjlbtn" @click="gotoOrder">兑换记录</text>
|
||||
<text class="zhushi">请在兑换时间内,按照礼券上的卡券密码填写,兑换成功后本券自动失效。</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
code_no: '',
|
||||
code_pwd: '',
|
||||
img: ''
|
||||
};
|
||||
},
|
||||
onLoad(e) {
|
||||
this.getData();
|
||||
},
|
||||
methods: {
|
||||
/*获取数据*/
|
||||
getData() {
|
||||
let self = this;
|
||||
uni.showLoading({
|
||||
title: '加载中',
|
||||
mask: true
|
||||
});
|
||||
self._get(
|
||||
'card.code/setting', {
|
||||
|
||||
},
|
||||
function(res) {
|
||||
self.img = res.data.setting.image;
|
||||
uni.hideLoading();
|
||||
}
|
||||
);
|
||||
},
|
||||
/*获取数据*/
|
||||
confirm() {
|
||||
let self = this;
|
||||
uni.showLoading({
|
||||
title: '正在处理',
|
||||
mask: true
|
||||
});
|
||||
self._get(
|
||||
'card.code/check', {
|
||||
code_no: self.code_no,
|
||||
code_pwd: self.code_pwd
|
||||
},
|
||||
function(res) {
|
||||
uni.hideLoading();
|
||||
self.gotoPage('/pages/code/order?order_id=' + res.data.order_id);
|
||||
}
|
||||
);
|
||||
},
|
||||
gotoOrder() {
|
||||
this.gotoPage('/pages/order/codeorder');
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.thbox {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
background-color: #e4e4e4;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
top: 0;
|
||||
|
||||
}
|
||||
|
||||
.thcontent {
|
||||
flex-direction: column;
|
||||
margin: 23rpx;
|
||||
padding: 45rpx;
|
||||
background: #fff;
|
||||
border-radius: 5rpx;
|
||||
position: relative;
|
||||
|
||||
}
|
||||
|
||||
.kabg {
|
||||
border-radius: 5rpx;
|
||||
margin-bottom: 50rpx;
|
||||
width: 615rpx;
|
||||
height: 617rpx;
|
||||
}
|
||||
|
||||
.srkbox {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 0 53rpx;
|
||||
box-sizing: border-box;
|
||||
padding-bottom: 100rpx;
|
||||
}
|
||||
|
||||
.kh {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
height: 106rpx;
|
||||
}
|
||||
|
||||
.khtxt {
|
||||
flex: 0.2;
|
||||
height: 64rpx;
|
||||
line-height: 64rpx;
|
||||
font-size: 34rpx;
|
||||
}
|
||||
|
||||
.khsr {
|
||||
flex: 0.8;
|
||||
border-bottom: 1px solid #eee;
|
||||
height: 74rpx;
|
||||
line-height: 74rpx;
|
||||
font-size: 30rpx;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.tsbox {
|
||||
display: inline-block;
|
||||
color: #ff5649;
|
||||
background-color: #ffe5e5;
|
||||
font-size: 24rpx;
|
||||
padding: 6rpx 30rpx;
|
||||
border-radius: 30rpx;
|
||||
margin: 20rpx 0;
|
||||
|
||||
}
|
||||
|
||||
.qubtn {
|
||||
position: absolute;
|
||||
bottom: -50rpx;
|
||||
left: 10%;
|
||||
width: 80%;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
background: linear-gradient(to bottom, #ff7220, #fbb700);
|
||||
border-radius: 40rpx;
|
||||
color: #fff;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
|
||||
.wbtxt {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
margin-top: 5%;
|
||||
}
|
||||
|
||||
.dhjlbtn {
|
||||
color: #459aff;
|
||||
font-size: 28rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.zhushi {
|
||||
width: 80%;
|
||||
text-align: center;
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
</style>
|
||||
335
pages/code/order.vue
Normal file
335
pages/code/order.vue
Normal file
@ -0,0 +1,335 @@
|
||||
<template>
|
||||
<view class="user-index">
|
||||
<!--提货地址-->
|
||||
<view class="thbox">
|
||||
<view class="spbox">
|
||||
<view class="spbt">
|
||||
<text class="sptit">订单号:</text>
|
||||
<text class="sptit2">{{detail.order_no}}</text>
|
||||
</view>
|
||||
<view class="spcon">
|
||||
<image class="sptu" :src="product.image[0].file_path"></image>
|
||||
<view class="sptxt">
|
||||
<text class="h1"> {{product.product_name}}</text>
|
||||
<text class="guige">{{detail.card.product_attr}}</text>
|
||||
<view class="num">
|
||||
<text class="price">¥{{product.product_price}}</text>
|
||||
<text class="numshu">X1</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view class="addbox">
|
||||
<text class="addbt">提货地址</text>
|
||||
<view class="row">
|
||||
<text class="rowtxt">收货人</text>
|
||||
<input class="rowsr" v-model="form.name" placeholder="请输入收货人姓名" />
|
||||
</view>
|
||||
<view class="row">
|
||||
<text class="rowtxt">手机号码</text>
|
||||
<input class="rowsr" v-model="form.mobile" placeholder="请输入手机号码" />
|
||||
</view>
|
||||
<view class="row">
|
||||
<text class="rowtxt">所在地区</text>
|
||||
<input class="rowsr" placeholder="" placeholder-class="grary9" v-model="selectCity" disabled="true"
|
||||
@click="showMulLinkageThreePicker" />
|
||||
</view>
|
||||
<view class="row">
|
||||
<text class="rowtxt">详细地址</text>
|
||||
<textarea class="rowdz" v-model="form.detail" placeholder="请输入详细地址" />
|
||||
</view>
|
||||
</view>
|
||||
<button class="qubtn" @click="submit">确认兑换</button>
|
||||
|
||||
</view>
|
||||
<mpvue-city-picker v-if="is_load" ref="mpvueCityPicker" :province="province" :city="city" :area="area"
|
||||
:pickerValueDefault="cityPickerValueDefault" @onConfirm="onConfirm"></mpvue-city-picker>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import mpvueCityPicker from '@/components/mpvue-citypicker/mpvueCityPicker.vue';
|
||||
export default {
|
||||
components: {
|
||||
mpvueCityPicker
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
temlIds: [],
|
||||
order_id: 0,
|
||||
product: {},
|
||||
cityPickerValueDefault: [0, 0, 0],
|
||||
selectCity: '选择省,市,区',
|
||||
detail: {},
|
||||
address: {},
|
||||
delta: 1,
|
||||
province: [],
|
||||
city: [],
|
||||
area: [],
|
||||
is_load: false,
|
||||
form: {
|
||||
name: '',
|
||||
mobile: '',
|
||||
province_id: 0,
|
||||
city_id: 0,
|
||||
region_id: 0,
|
||||
detail: '',
|
||||
}
|
||||
};
|
||||
},
|
||||
onLoad(e) {
|
||||
this.order_id = e.order_id;
|
||||
this.getData();
|
||||
this.getRegionData();
|
||||
},
|
||||
methods: {
|
||||
/*获取数据*/
|
||||
getData() {
|
||||
let self = this;
|
||||
self._get(
|
||||
'card.code/order', {
|
||||
order_id: self.order_id
|
||||
},
|
||||
function(res) {
|
||||
self.detail = res.data.detail;
|
||||
self.product = res.data.product;
|
||||
self.temlIds = res.data.template_arr;
|
||||
}
|
||||
);
|
||||
},
|
||||
// 获取省市区
|
||||
getRegionData() {
|
||||
let self = this;
|
||||
self._post('settings/getRegion', {}, function(res) {
|
||||
self.province = res.data.regionData[0];
|
||||
self.city = res.data.regionData[1];
|
||||
self.area = res.data.regionData[2];
|
||||
self.is_load = true;
|
||||
|
||||
});
|
||||
},
|
||||
/*三级联动选择*/
|
||||
showMulLinkageThreePicker() {
|
||||
this.$refs.mpvueCityPicker.show();
|
||||
},
|
||||
|
||||
/*确定选择的省市区*/
|
||||
onConfirm(e) {
|
||||
this.selectCity = e.label;
|
||||
this.form.province_id = e.cityCode[0];
|
||||
this.form.city_id = e.cityCode[1];
|
||||
this.form.region_id = e.cityCode[2];
|
||||
},
|
||||
submit() {
|
||||
let self = this;
|
||||
console.log(self.form);
|
||||
if (self.form.name == '') {
|
||||
uni.showToast({
|
||||
title: '请输入收货人姓名',
|
||||
duration: 1000,
|
||||
icon: 'none'
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
if (self.form.mobile == '') {
|
||||
uni.showToast({
|
||||
title: '请输入手机号码',
|
||||
duration: 1000,
|
||||
icon: 'none'
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
if (self.form.province_id == 0 || self.form.city_id == 0 || self.form.region_id == 0) {
|
||||
uni.showToast({
|
||||
title: '请选择所在地区',
|
||||
duration: 1000,
|
||||
icon: 'none'
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
if (self.form.detail == '') {
|
||||
uni.showToast({
|
||||
title: '请输入街道小区楼牌号等',
|
||||
duration: 1000,
|
||||
icon: 'none'
|
||||
});
|
||||
return false;
|
||||
}
|
||||
self.form.order_id = self.order_id;
|
||||
let callback = function() {
|
||||
self._post('card.code/order', self.form, function(res) {
|
||||
self.showSuccess(res.msg, function() {
|
||||
self.gotoPage('/pages/order/codeorder');
|
||||
});
|
||||
});
|
||||
};
|
||||
self.subMessage(self.temlIds, callback);
|
||||
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.thbox {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
background-color: #e4e4e4;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
top: 0;
|
||||
|
||||
}
|
||||
|
||||
.spbox {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 84%;
|
||||
padding: 5%;
|
||||
margin: 20rpx 0;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.spbt {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
height: 64rpx;
|
||||
line-height: 64rpx;
|
||||
border-bottom: 1px solid #eee;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.sptit {
|
||||
font-size: 26rpx;
|
||||
color: #333;
|
||||
|
||||
}
|
||||
|
||||
.sptit2 {
|
||||
font-size: 26rpx;
|
||||
color: #999;
|
||||
|
||||
}
|
||||
|
||||
.spcon {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.sptu {
|
||||
width: 50%;
|
||||
height: 192rpx;
|
||||
border-radius: 10rpx;
|
||||
|
||||
}
|
||||
|
||||
.sptxt {
|
||||
width: 80%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
|
||||
.h1 {
|
||||
font-size: 32rpx;
|
||||
line-height: 32rpx;
|
||||
height: 32rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.guige {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
margin: 20rpx 0;
|
||||
}
|
||||
|
||||
.num {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
align-items: flex-end;
|
||||
}
|
||||
|
||||
.price {
|
||||
font-size: 36rpx;
|
||||
font-weight: bold;
|
||||
color: #000;
|
||||
|
||||
}
|
||||
|
||||
.numshu {
|
||||
color: #999;
|
||||
font-size: 28rpx;
|
||||
|
||||
}
|
||||
|
||||
.addbox {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 84%;
|
||||
padding: 5%;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.addbt {
|
||||
font-size: 36rpx;
|
||||
color: #333;
|
||||
border-bottom: 1px solid #eee;
|
||||
padding-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.row {
|
||||
display: flex;
|
||||
border-bottom: 1px solid #eee;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.rowtxt {
|
||||
flex: 0.3;
|
||||
line-height: 64rpx;
|
||||
height: 64rpx;
|
||||
padding: 20rpx 0;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
.rowsr {
|
||||
flex: 0.7;
|
||||
line-height: 64rpx;
|
||||
height: 64rpx;
|
||||
color: #999;
|
||||
padding: 20rpx 0;
|
||||
font-size: 28rpx;
|
||||
|
||||
}
|
||||
|
||||
.rowdz {
|
||||
flex: 0.7;
|
||||
line-height: 64rpx;
|
||||
height: 128rpx;
|
||||
overflow: hidden;
|
||||
color: #999;
|
||||
padding: 20rpx 0;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.qubtn {
|
||||
width: 80%;
|
||||
margin-top: 40rpx;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
background: linear-gradient(to bottom, #ff7220, #fbb700);
|
||||
border-radius: 40rpx;
|
||||
color: #fff;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user