Browse Source

【完善】 填写信息、藏品寄送页面交互

master
邓平艺 4 years ago
parent
commit
33409e9bbb
  1. 12
      common/mixin.js
  2. 2
      common/request.js
  3. 21
      packages/address/address.vue
  4. 102
      pages/write/baseInfo.vue
  5. 73
      pages/write/distribution.vue

12
common/mixin.js

@ -10,14 +10,14 @@ export default{
methods: { methods: {
// 判断对错/是否显示,万能校验 // 判断对错/是否显示,万能校验
$isRight(obj){ $isRight(obj){
if (isValueType(obj) === 'string') {
if (this.$valueType(obj) === 'string') {
obj = obj.trim(); obj = obj.trim();
if (obj === 'null' || obj === 'undefined') { if (obj === 'null' || obj === 'undefined') {
return false; return false;
} }
} else if (isValueType(obj) === 'number' && (isValueType(obj) === "number" && !isNaN(obj)) && obj !== 0) {
} else if (this.$valueType(obj) === 'number' && (this.$valueType(obj) === "number" && !isNaN(obj)) && obj !== 0) {
return true; return true;
} else if (isValueType(obj) === 'boolean') {
} else if (this.$valueType(obj) === 'boolean') {
return obj return obj
} }
for (var key in obj) { for (var key in obj) {
@ -64,11 +64,13 @@ export default{
} }
}, 100); }, 100);
}, },
$toBack(){
$toBack(delta = 1){
let pages = getCurrentPages(); // 当前页 let pages = getCurrentPages(); // 当前页
let beforePage = pages[pages.length - 2]; // 上个页面 let beforePage = pages[pages.length - 2]; // 上个页面
if(beforePage && beforePage.route){ if(beforePage && beforePage.route){
uni.navigateBack();
uni.navigateBack({
delta: delta
});
}else{ }else{
uni.reLaunch({url:'/pages/index/index'}); uni.reLaunch({url:'/pages/index/index'});
} }

2
common/request.js

@ -90,7 +90,7 @@ export const request = options => {
console.log(url, data); console.log(url, data);
// 动态赋值是否显示loading加载框 TODO验证一下是否有问题 // 动态赋值是否显示loading加载框 TODO验证一下是否有问题
if(that.$shared.isValueType(showLoading) != 'undefined'){
if(that.$valueType(showLoading) != 'undefined'){
that.$u.http.setConfig({showLoading}); that.$u.http.setConfig({showLoading});
} }

21
packages/address/address.vue

@ -1,7 +1,7 @@
<template> <template>
<view style="flex-direction: column;"> <view style="flex-direction: column;">
<scroll-view class="scroll-view" :scroll-y="true"> <scroll-view class="scroll-view" :scroll-y="true">
<view class="addressItem" v-for="(item, index) in addressList" :key="item.id">
<view class="addressItem" v-for="(item, index) in addressList" :key="item.id" @click="selectAddress(item)">
<view class="addressItemTop"> <view class="addressItemTop">
<text class="addrName">{{ item.name }}</text> <text class="addrName">{{ item.name }}</text>
<text class="addrTel">{{ item.phone }}</text> <text class="addrTel">{{ item.phone }}</text>
@ -9,15 +9,15 @@
<text class="addr">{{ item.address }}</text> <text class="addr">{{ item.address }}</text>
<view class="line"></view> <view class="line"></view>
<view class="optionsPanel"> <view class="optionsPanel">
<radio-group @change="radioChange">
<radio-group @change="radioChange" @click.stop>
<label> <label>
<radio :value="item.id" :checked="item.isDefault" color="#e7a23f"></radio> <radio :value="item.id" :checked="item.isDefault" color="#e7a23f"></radio>
<text>设置为默认地址</text> <text>设置为默认地址</text>
</label> </label>
</radio-group> </radio-group>
<view class="rightPanel"> <view class="rightPanel">
<image class="optionsBtn" src="../../static/删除.png" @click="remove"></image>
<image class="optionsBtnEdit" src="../../static/编辑.png" @click="$url('/packages/addAddress/addAddress?id='+ item.id)"></image>
<image class="optionsBtn" src="../../static/删除.png" @click.stop="remove"></image>
<image class="optionsBtnEdit" src="../../static/编辑.png" @click.stop="$url('/packages/addAddress/addAddress?id='+ item.id)"></image>
</view> </view>
</view> </view>
<view style="height: 30rpx;background-color: #F6F6F6;"></view> <view style="height: 30rpx;background-color: #F6F6F6;"></view>
@ -51,9 +51,13 @@
phone: '18454545455', phone: '18454545455',
address: '北京北京市海淀区钻石大厦C座', address: '北京北京市海淀区钻石大厦C座',
isDefault: false isDefault: false
}]
}],
is_select: false
} }
}, },
onLoad(options){
this.is_select = Boolean(Number(options.is_select || '0'));
},
methods: { methods: {
radioChange(event){ radioChange(event){
let id = event.detail.value; let id = event.detail.value;
@ -67,6 +71,13 @@
}, },
remove(){ remove(){
this.$msg('删除') this.$msg('删除')
},
selectAddress(item){
if(!this.is_select) return;
let pages = getCurrentPages();
let page = pages[pages.length - 2]; // 访
page.$vm.address = item; //
this.$toBack();
} }
} }
} }

102
pages/write/baseInfo.vue

@ -30,18 +30,32 @@
<view class="section_3"> </view> <view class="section_3"> </view>
</view> </view>
</view> </view>
<view class="flex-col section_4">
<view class="justify-between">
<view class="flex-row">
<text class="text_6">李丽丽</text>
<text class="text_7">15273936409</text>
</view>
<image
src="https://project-user-resource-1256085488.cos.ap-guangzhou.myqcloud.com/62677e395a7e3f03107ffc5f/62677e4a35a7e10011e93a80/16509497893779891395.png"
class="image_10 image_11"
/>
</view>
<text class="text_8">北京北京市海淀区钻石大厦C座</text>
<view class="flex-col section_4" @click="$url('/packages/address/address?is_select=1')">
<view v-if="$isRight(address)">
<view class="justify-between">
<view class="flex-row">
<text class="text_6">{{ address.name }}</text>
<text class="text_7">{{ address.phone }}</text>
</view>
<image
src="https://project-user-resource-1256085488.cos.ap-guangzhou.myqcloud.com/62677e395a7e3f03107ffc5f/62677e4a35a7e10011e93a80/16509497893779891395.png"
class="image_10 image_11"
/>
</view>
<text class="text_8">{{ address.address }}</text>
</view>
<!-- 没有选择地址时 -->
<view v-else>
<view class="justify-between">
<view class="flex-row">
<text class="lf-font-32">点击选择收货地址</text>
</view>
<image
src="https://project-user-resource-1256085488.cos.ap-guangzhou.myqcloud.com/62677e395a7e3f03107ffc5f/62677e4a35a7e10011e93a80/16509497893779891395.png"
class="image_10 image_11"
/>
</view>
</view>
</view> </view>
<view class="flex-col section_5"> <view class="flex-col section_5">
<view class="justify-between"> <view class="justify-between">
@ -56,30 +70,34 @@
</view> </view>
<view class="flex-row group_14"> <view class="flex-row group_14">
<text class="text_11">送评人</text> <text class="text_11">送评人</text>
<text class="text_12">送评人</text>
<!-- <text class="text_12">送评人</text> -->
<u-input v-model="sonpingInfo.name" placeholder="请输入送评人"></u-input>
</view> </view>
<view class="flex-row group_15"> <view class="flex-row group_15">
<text class="text_13">手机号</text> <text class="text_13">手机号</text>
<text class="text_14">18266785384</text>
<!-- <text class="text_14">18266785384</text> -->
<u-input v-model="sonpingInfo.phone" placeholder="请输入送评人手机号" type="number"></u-input>
</view> </view>
<view class="flex-row group_16"> <view class="flex-row group_16">
<text class="text_15">数量</text> <text class="text_15">数量</text>
<text class="text_16">3</text>
<!-- <text class="text_16">3</text> -->
<u-input v-model="sonpingInfo.number" placeholder="请输入送评数量" type="number"></u-input>
</view> </view>
<view class="justify-between group_17"> <view class="justify-between group_17">
<view class="flex-row group_18"> <view class="flex-row group_18">
<text class="text_17">是否快评</text> <text class="text_17">是否快评</text>
<text class="text_18">(价格翻倍)</text> <text class="text_18">(价格翻倍)</text>
</view> </view>
<image
<!-- <image
src="https://project-user-resource-1256085488.cos.ap-guangzhou.myqcloud.com/62677e395a7e3f03107ffc5f/62677e4a35a7e10011e93a80/16509497893774083601.png" src="https://project-user-resource-1256085488.cos.ap-guangzhou.myqcloud.com/62677e395a7e3f03107ffc5f/62677e4a35a7e10011e93a80/16509497893774083601.png"
class="switch" class="switch"
/>
/> -->
<u-switch v-model="isQuickReview" activeColor="#e7a23f"></u-switch>
</view> </view>
<view class="flex-col group_19"> <view class="flex-col group_19">
<text>打包照片</text> <text>打包照片</text>
<view class="flex-row equal-division_1"> <view class="flex-row equal-division_1">
<image
<!-- <image
src="https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/62677e395a7e3f03107ffc5f/62677e4a35a7e10011e93a80/16509497768828992333.png" src="https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/62677e395a7e3f03107ffc5f/62677e4a35a7e10011e93a80/16509497768828992333.png"
class="equal-division-item_1 image_13" class="equal-division-item_1 image_13"
/> />
@ -90,14 +108,25 @@
<image <image
src="https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/62677e395a7e3f03107ffc5f/62677e4a35a7e10011e93a80/16509497768986098398.png" src="https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/62677e395a7e3f03107ffc5f/62677e4a35a7e10011e93a80/16509497768986098398.png"
class="equal-division-item_1" class="equal-division-item_1"
/>
/> -->
<u-upload
:fileList="fileList"
name="1"
multiple
:maxCount="4"
:previewFullImage="true"
@afterRead="afterRead"
@delete="deletePic"
></u-upload>
</view> </view>
</view> </view>
<view class="flex-col group_20"> <view class="flex-col group_20">
<text class="text_20">备注</text> <text class="text_20">备注</text>
<view class="flex-col items-start text-wrapper">
<!-- <view class="flex-col items-start text-wrapper">
<text class="text_21">请输入您想要备注的信息</text> <text class="text_21">请输入您想要备注的信息</text>
</view>
</view> -->
<u-textarea v-model="remarks" placeholder="请输入备注" :height="100" class="textarea" :count="true"></u-textarea>
</view> </view>
<view class="flex-col group_21"> <view class="flex-col group_21">
<view class="flex-col items-center button" @click="$url('/pages/write/distribution')"> <view class="flex-col items-center button" @click="$url('/pages/write/distribution')">
@ -113,8 +142,26 @@
<script> <script>
export default { export default {
data() { data() {
return {};
return {
address: {},
isQuickReview: false,
sonpingInfo: {
name: '',
phone: '',
number: ''
},
fileList: [],
remarks: ''
};
}, },
methods: {
afterRead(event){
this.fileList.push(...event.file);
},
deletePic(event){
this.fileList.splice(event.index, 1);
}
}
}; };
</script> </script>
@ -186,16 +233,18 @@
color: rgb(51, 51, 51); color: rgb(51, 51, 51);
font-size: 32rpx; font-size: 32rpx;
line-height: 44rpx; line-height: 44rpx;
white-space: nowrap;
} }
.group_14 { .group_14 {
margin-top: 40rpx; margin-top: 40rpx;
align-items: center;
} }
.group_15 { .group_15 {
margin-top: 50rpx; margin-top: 50rpx;
align-items: center;
} }
.group_16 { .group_16 {
margin-top: 50rpx; margin-top: 50rpx;
align-items: center;
} }
.group_17 { .group_17 {
margin-top: 44rpx; margin-top: 44rpx;
@ -341,7 +390,6 @@
.section_6 { .section_6 {
margin-top: 22rpx; margin-top: 22rpx;
align-self: center; align-self: center;
background-color: rgb(0, 0, 0);
border-radius: 4rpx; border-radius: 4rpx;
width: 196rpx; width: 196rpx;
height: 8rpx; height: 8rpx;
@ -383,4 +431,10 @@
.text_21 { .text_21 {
margin-left: 30rpx; margin-left: 30rpx;
} }
/deep/.u-textarea{
background-color: #f6f6f6 !important;
margin-top: 20rpx;
border-radius: 10rpx;
}
</style> </style>

73
pages/write/distribution.vue

@ -32,31 +32,35 @@
</view> </view>
</view> </view>
<view class="flex-col section_2"> <view class="flex-col section_2">
<view class="justify-between">
<view class="flex-row">
<text class="text_6">快递公司</text>
<text class="text_7">请选择快递公司</text>
</view>
<image
src="https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/62677e395a7e3f03107ffc5f/62677e4a35a7e10011e93a80/16509497774758380231.png"
class="image_11"
/>
</view>
<picker mode="selector" :range="expressList" range-key="label" @change="pickerChange">
<view class="justify-between">
<view class="flex-row">
<text class="text_6">快递公司</text>
<text class="text_7">{{ expressIndex !== '' ? expressList[expressIndex].label : '请选择快递公司' }}</text>
</view>
<image
src="https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/62677e395a7e3f03107ffc5f/62677e4a35a7e10011e93a80/16509497774758380231.png"
class="image_11"
/>
</view>
</picker>
<view class="justify-between group_11"> <view class="justify-between group_11">
<view class="flex-row">
<view class="flex-row" style="align-items: center;">
<text class="text_8">快递单号</text> <text class="text_8">快递单号</text>
<text class="text_9">请填写快递单号</text>
<!-- <text class="text_9">请填写快递单号</text> -->
<u-input v-model="oddNumber" placeholder="请填写快递单号" maxlength="18"></u-input>
</view> </view>
<image <image
src="https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/62677e395a7e3f03107ffc5f/62677e4a35a7e10011e93a80/16509497774389520756.png" src="https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/62677e395a7e3f03107ffc5f/62677e4a35a7e10011e93a80/16509497774389520756.png"
class="image_5 image_12" class="image_5 image_12"
@click="scan"
/> />
</view> </view>
</view> </view>
<view class="flex-col section_3"> <view class="flex-col section_3">
<view class="justify-between"> <view class="justify-between">
<text class="text_10">寄送地址</text> <text class="text_10">寄送地址</text>
<text class="text_11">一键复制</text>
<text class="text_11" @click="setClipboardData">一键复制</text>
</view> </view>
<view class="flex-row group_14"> <view class="flex-row group_14">
<text class="text_12">收货人</text> <text class="text_12">收货人</text>
@ -76,8 +80,8 @@
<view class="flex-col items-center button" @click="$url('/packages/sonpingDetail/sonpingDetail')"> <view class="flex-col items-center button" @click="$url('/packages/sonpingDetail/sonpingDetail')">
<text>送评</text> <text>送评</text>
</view> </view>
<text class="text_19">稍后填写</text>
<view class="section_4"> </view>
<text class="text_19" @click="$toBack(2)">稍后填写</text>
<view style="width: 100%; height: 30rpx;"></view>
</view> </view>
</view> </view>
</view> </view>
@ -86,8 +90,35 @@
<script> <script>
export default { export default {
data() { data() {
return {};
return {
oddNumber: '',
expressList: [{
label: '中通快递',
value: '1'
},{
label: '圆通快递',
value: '2'
}],
expressIndex: ''
};
}, },
methods: {
setClipboardData(){
uni.setClipboardData({
data: '复制'
})
},
scan(){
uni.scanCode({
complete: result => {
this.oddNumber = result.result;
}
})
},
pickerChange(event){
this.expressIndex = event.detail.value;
}
}
}; };
</script> </script>
@ -173,14 +204,7 @@
line-height: 40rpx; line-height: 40rpx;
white-space: nowrap; white-space: nowrap;
} }
.section_4 {
margin-top: 246rpx;
align-self: center;
background-color: rgb(0, 0, 0);
border-radius: 4rpx;
width: 196rpx;
height: 8rpx;
}
.equal-division { .equal-division {
padding: 30rpx 14rpx; padding: 30rpx 14rpx;
background-color: rgb(255, 255, 255); background-color: rgb(255, 255, 255);
@ -193,6 +217,7 @@
} }
.group_11 { .group_11 {
margin-top: 50rpx; margin-top: 50rpx;
align-items: center;
} }
.group_14 { .group_14 {
margin-top: 40rpx; margin-top: 40rpx;

Loading…
Cancel
Save