Commit f32d7399 authored by Facius's avatar Facius

Merge branch 'dev' of https://git.banshouhui.com/lijundan/self-support into dev

parents ef87c320 db4526e4
let partsApiFun = function(vm){ let partsApiFun = function(vm){
// 接口公共前缀 // 接口公共前缀
const prefix = '/wxh-worker-rest/rest/' const prefix = '/wxh-worker-rest/rest/'
let coverage = '/wxh-worker-rest/rest/coverage/' const coverage = '/wxh-worker-rest/rest/coverage/'
let parts = '/wxh-worker-rest/rest/parts/' const parts = '/wxh-worker-rest/rest/parts/'
const base = '/wxh-worker-rest/rest/base/'
/** /**
* 配件申请单-查询网点地址信息 * 配件申请单-查询网点地址信息
*/ */
let getSiteAddress = async () => await vm.$u.get(coverage + vm.vuex_token + '/getSiteAddress'); let getSiteAddress = async () => await vm.$u.get(coverage + vm.vuex_token + '/getSiteAddress');
/**
* 配件过滤-品类列表
*/
let getCategoryList = async () => await vm.$u.get(base + vm.vuex_token + '/allow/category/list');
/**
* 配件过滤-品牌列表
*/
let getBrandList = async (params = {}) => await vm.$u.get(base + vm.vuex_token + '/allow/brand/list', params);
/**
* 查询配件列表
*/
let getPartsList = async (params = {}) => await vm.$u.get(parts + vm.vuex_token + '/parts', params);
const partsApi = { const partsApi = {
getSiteAddress getSiteAddress,
getCategoryList,
getBrandList,
getPartsList
} }
return partsApi return partsApi
} }
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
```json ```json
{ {
"name": "正泰漏保", // 配件名称 "name": "正泰漏保", // 配件名称
"num": 1, // 配件数量 "quantity": 1, // 配件数量
"min": 1, // 数量最小值 "min": 1, // 数量最小值
"max": 100 // 数量最大值 "max": 100 // 数量最大值
} }
...@@ -56,14 +56,14 @@ export default { ...@@ -56,14 +56,14 @@ export default {
{ {
id: 1, id: 1,
name: "正泰漏保", name: "正泰漏保",
num: 1, quantity: 1,
min: 1, min: 1,
max: 100, max: 100,
}, },
{ {
id: 1, id: 1,
name: "挚达广汽充电桩", name: "挚达广汽充电桩",
num: 3, quantity: 3,
min: 1, min: 1,
max: 5, max: 5,
}, },
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
{{info.name}} {{info.name}}
</view> </view>
<view class="num"> <view class="num">
<u-number-box v-if="!disabled" v-model="info.num" :min="info.min || 0" :max="info.max || info.num" @change="numChange"></u-number-box> <u-number-box v-if="!disabled" v-model="info.quantity" :min="info.min || 0" :max="info.max || info.quantity" @change="numChange"></u-number-box>
<text class="nums" v-else>x{{ info.num || 1 }}</text> <text class="nums" v-else>x{{ info.num || 1 }}</text>
</view> </view>
</view> </view>
......
...@@ -19,12 +19,12 @@ ...@@ -19,12 +19,12 @@
{ {
id: 1, id: 1,
name: "正泰漏保", // 名称 name: "正泰漏保", // 名称
no: 'NO.202006170015', // 编号 code: 'NO.202006170015', // 编号
desc: '这个空开盒子和其他的空开有什么不一样,这里可以写一下', // 描述 remark: '这个空开盒子和其他的空开有什么不一样,这里可以写一下', // 描述
num: 1, // 默认数量 quantity: 1, // 默认数量
min: 1, // 数量最小值 min: 1, // 数量最小值
max: 100, // 数量最大值 max: 100, // 数量最大值
img: "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png", // 图片 images: "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png", // 图片
checked: false, // 是否勾选 checked: false, // 是否勾选
disabled: true // 是否禁用数量调整,如果禁用则会显示添加申请按钮 disabled: true // 是否禁用数量调整,如果禁用则会显示添加申请按钮
} }
...@@ -66,24 +66,24 @@ export default { ...@@ -66,24 +66,24 @@ export default {
{ {
id: 1, id: 1,
name: "正泰漏保", name: "正泰漏保",
no: 'NO.202006170015', code: 'NO.202006170015',
desc: '这个空开盒子和其他的空开有什么不一样,这里可以写一下', remark: '这个空开盒子和其他的空开有什么不一样,这里可以写一下',
num: 1, quantity: 1,
min: 1, min: 1,
max: 100, max: 100,
img: "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png", image: "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png",
checked: false, checked: false,
disabled: true disabled: true
}, },
{ {
id: 1, id: 1,
name: "挚达广汽充电桩", name: "挚达广汽充电桩",
no: 'NO.202006170014', code: 'NO.202006170014',
desc: '这个空开盒子和其他的空开有什么不一样,这里可以写一下', remark: '这个空开盒子和其他的空开有什么不一样,这里可以写一下',
num: 3, quantity: 3,
min: 1, min: 1,
max: 5, max: 5,
img: "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png", image: "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png",
checked: false, checked: false,
disabled: true disabled: true
}, },
......
...@@ -5,17 +5,17 @@ ...@@ -5,17 +5,17 @@
</view> </view>
<view class="u-flex right"> <view class="u-flex right">
<view class="right-img"> <view class="right-img">
<u-image :src="info.img" width="200rpx" height="200rpx" /> <u-image :src="info.images" width="200rpx" height="200rpx" />
</view> </view>
<view class="u-flex right-content"> <view class="u-flex right-content">
<view class="right-content-name">{{ info.name }}</view> <view class="right-content-name">{{ info.name }}</view>
<view class="right-content-desc">{{ info.desc }}</view> <view class="right-content-desc">{{ info.remark }}</view>
<view class="u-flex right-content-opera"> <view class="u-flex right-content-opera">
<view class="no"> <view class="no">
{{ info.no }} {{ info.code }}
</view> </view>
<view class="num"> <view class="num">
<u-number-box v-if="!info.disabled" v-model="info.num" :min="info.min || 0" :max="info.max || info.num" @change="numChange"></u-number-box> <u-number-box v-if="!info.disabled" v-model="info.quantity" :min="info.min || 0" :max="info.max || info.quantity" @change="numChange"></u-number-box>
<u-button v-if="info.disabled" type="primary" size="mini" shape="circle" @click="addApply">加入申请</u-button> <u-button v-if="info.disabled" type="primary" size="mini" shape="circle" @click="addApply">加入申请</u-button>
</view> </view>
</view> </view>
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
| showChecked | Boolean | true | true/false | 是否显示勾选 | | showChecked | Boolean | true | true/false | 是否显示勾选 |
| allChecked | Boolean | true | true/false | 是否全选 | | allChecked | Boolean | true | true/false | 是否全选 |
| btnStatus | Boolean | true | true/false | 确定按钮是否可点击 | | btnStatus | Boolean | true | true/false | 确定按钮是否可点击 |
| btnStatus | Boolean | true | true/false | 确定按钮是否可点击 |
| partNum | Number | 0 | | 配件数量 | | partNum | Number | 0 | | 配件数量 |
| num | Number | 0 | | 合计总件数 | | num | Number | 0 | | 合计总件数 |
| submitTxt | String | 确定 | | 确定按钮文字 | | submitTxt | String | 确定 | | 确定按钮文字 |
......
<template>
<view class="item" @click="$u.throttle(editSite, 500)">
<view class="userinfo u-flex">
<view class="name">{{ formatName }}</view>
<view class="mobile">{{ formatMobile }}</view>
</view>
<view class="siteinfo u-flex u-row-between u-col-top">
<view class="txt">{{ formatAddress }}</view>
<u-icon custom-prefix="wxh" name="pen" size="32"></u-icon>
</view>
<view class="default" v-show="isDefault">
<u-icon name="checkmark-circle" color="#2272FF" size="32"></u-icon>
<text class="txt">默认地址</text>
</view>
</view>
</template>
<script>
/**
* navbar 自定义地址单元格
* @description 此组件一般用于地址显示列。
* @property {Object} info 地址信息(默认{name: '', mobile: '', address: ''})
* @property {Boolean} is-default 是否为默认地址(默认 false)
* @event {Function()} edit-site 编辑地址
* @example <w-address :info="addressInfo" :isDefault="true" />
*/
export default {
name: 'w-address',
props: {
info: {
type: Object,
default() {
return {name: '', mobile: '', address: ''};
}
},
isDefault: {
type: Boolean,
default: false
},
siteType: {
type: String,
default: 'edit'
}
},
data() {
return {};
},
computed: {
formatName() {
let name = this.info && this.info.name;
if (this.$u.test.isEmpty(name)) {
return '--';
} else {
return name;
}
},
formatMobile() {
let mobile = this.info && this.info.mobile;
if (this.$u.test.isEmpty(mobile)) {
return '--';
}
if (mobile.length == 11) {
let tmps = [];
tmps[0] = mobile.slice(0, 3);
tmps[1] = mobile.slice(3, 7);
tmps[2] = mobile.slice(7);
return tmps.join(' ');
} else {
return mobile;
}
},
formatAddress() {
let address = this.info && this.info.address;
if (this.$u.test.isEmpty(address)) {
return '--';
} else {
return address;
}
}
},
methods: {
editSite() {
this.$emit('edit-site', this.info)
},
}
};
</script>
<style lang="scss" scoped>
.item {
.userinfo {
.name {
height: 92rpx;
font-size: 32rpx;
font-weight: bold;
color: #333333;
line-height: 92rpx;
}
.mobile {
margin-left: 20rpx;
height: 92rpx;
font-size: 28rpx;
font-weight: 400;
color: #666666;
line-height: 92rpx;
}
}
.siteinfo {
.txt {
width: 500rpx;
font-size: 28rpx;
font-weight: 400;
color: #333333;
line-height: 34rpx;
word-wrap: break-word;
}
}
.default {
border-top: 2rpx solid #F4F5F7;
margin-top: 22rpx;
padding-top: 30rpx;
.txt {
margin-left: 12rpx;
font-size: 28rpx;
font-weight: 400;
color: #333333;
line-height: 28rpx;
}
}
}
</style>
...@@ -378,13 +378,8 @@ ...@@ -378,13 +378,8 @@
{ {
"path": "parts", "path": "parts",
"style": { "style": {
"navigationBarTitleText": "可用备件" "navigationBarTitleText": "可用备件",
} "disableScroll": true
},
{
"path": "partsList",
"style": {
"navigationBarTitleText": "配件选择"
} }
} }
] ]
...@@ -516,6 +511,12 @@ ...@@ -516,6 +511,12 @@
"navigationStyle": "custom", "navigationStyle": "custom",
"disableScroll": true "disableScroll": true
} }
},
{
"path": "addParts",
"style": {
"navigationBarTitleText": "配件选择"
}
} }
] ]
} }
......
...@@ -59,10 +59,10 @@ ...@@ -59,10 +59,10 @@
* @property {String} type 编辑类型(默认为修改,add--新增、edit--修改、select--选择) * @property {String} type 编辑类型(默认为修改,add--新增、edit--修改、select--选择)
* @property {String} info 地址信息(json字符串:包含地址信息) * @property {String} info 地址信息(json字符串:包含地址信息)
*/ */
import Utils from '@/utils/callUtils.js'
let r = require('libs/bmap-wx.min.js'); let r = require('libs/bmap-wx.min.js');
let h = new r.BMapWX({ let h = new r.BMapWX({
// ak: process.uniEnv.bmapAK, ak: process.uniEnv.bmapAK,
ak: 'G1wPip2Oj62NnoUctXhiE1faZVHbeo2A'
}); });
export default { export default {
data() { data() {
...@@ -97,11 +97,12 @@ export default { ...@@ -97,11 +97,12 @@ export default {
}; };
} }
}, },
async onLoad(e) { onLoad(e) {
getApp().trackPage('我的收获地址修改页'); getApp().trackPage('我的收获地址修改页');
if (!this.vuex_token) { if (!this.vuex_token) {
this.$u.route({ url: 'pages/login/index' }); this.$u.route({ url: 'pages/login/index' });
} }
debugger
if (e) { if (e) {
if (e.type === 'add') { if (e.type === 'add') {
this.title = '新增地址'; this.title = '新增地址';
...@@ -109,13 +110,24 @@ export default { ...@@ -109,13 +110,24 @@ export default {
} else if (e.type === 'select') { } else if (e.type === 'select') {
this.title = '选择地址'; this.title = '选择地址';
this.siteType = 'select'; this.siteType = 'select';
} else if (e.info && this.$u.test.jsonString(e.info)) {
// 默认修改我的地址
this.siteInfo = JSON.parse(decodeURIComponent(e.info));
} else if (e.type == 'edit') { } else if (e.type == 'edit') {
this.title = '修改地址'; this.title = '修改地址';
this.siteType = 'edit'; this.siteType = 'edit';
} }
if(e.name) {
this.name = decodeURIComponent(e.name);
}
if(e.mobile) {
this.mobile = decodeURIComponent(e.mobile);
}
if(e.address) {
this.address = decodeURIComponent(e.address);
}
if(e.region) {
let regionStr = decodeURIComponent(e.region);
this.region = regionStr.split('-')
}
} }
}, },
onShow() { onShow() {
...@@ -226,6 +238,7 @@ export default { ...@@ -226,6 +238,7 @@ export default {
async submitForm() { async submitForm() {
if (this.siteType === 'add') { if (this.siteType === 'add') {
} else if (this.siteType === 'select') { } else if (this.siteType === 'select') {
this.commitSite()
} else if (this.siteType === 'edit') { } else if (this.siteType === 'edit') {
if (this.$u.test.isEmpty(this.siteInfo)) { if (this.$u.test.isEmpty(this.siteInfo)) {
let params = { let params = {
...@@ -244,6 +257,21 @@ export default { ...@@ -244,6 +257,21 @@ export default {
} }
} }
},
commitSite() {
// 获取当前页面栈的实例,以数组形式按栈的顺序给出,第一个元素为首页,最后一个元素为当前页面。
var pages = getCurrentPages();
var prevPage = pages[pages.length - 2]; //上一个页面
//prevPage.route获取上一页面的页面路径
let address = this.region.join("") + this.address
let site = {
name: this.name,
mobile: this.mobile,
address: address,
region: this.region
}
Utils.$emit("update-site", site)
this.$u.route({ type: 'back' });
} }
} }
}; };
......
<template> <template>
<view class="address-wrap"> <view class="address-wrap">
<w-navbar title="收货地址"></w-navbar> <w-navbar title="收货地址"></w-navbar>
<view class="item" v-if="hasAdderss" @tap="toAddSite('修改地址')"> <view class="body" v-if="hasAdderss">
<view class="top"> <w-address @editSite="toAddSite" :info="address" :is-default="true" />
<view class="name">{{ settled.id_card_name || settled.nickname || settled.name || '--' }}</view>
<view class="phone">{{ settled.mobile }}</view>
</view>
<view class="bottom">
<view class="address">{{ settled.address }}</view>
<u-icon :name="editPen" :size="32" color="#999999"></u-icon>
</view>
<view class="default" v-show="true">
<u-icon name="checkmark-circle" color="#2272FF" size="32"></u-icon>
<text class="txt">默认地址</text>
</view>
</view> </view>
</view> </view>
</template> </template>
...@@ -39,6 +28,13 @@ export default { ...@@ -39,6 +28,13 @@ export default {
hasAdderss() { hasAdderss() {
return this.settled && this.settled.address && this.settled.id_card_name return this.settled && this.settled.address && this.settled.id_card_name
}, },
address() {
return {
name: this.settled.id_card_name || this.settled.nickname || this.settled.name,
mobile: this.settled.mobile,
address: this.settled.address
}
}
}, },
onLoad() { onLoad() {
getApp().trackPage('我的收获地址页') getApp().trackPage('我的收获地址页')
...@@ -71,48 +67,10 @@ export default { ...@@ -71,48 +67,10 @@ export default {
.address-wrap { .address-wrap {
background-color: #F4F5F7; background-color: #F4F5F7;
} }
.item { .body {
padding: 30rpx;
margin: 30rpx; margin: 30rpx;
padding: 50rpx 30rpx 48rpx 30rpx; border-radius: 12rpx;
background-color: #FFFFFF; background-color: #FFFFFF;
border-radius: 12px;
.top {
display: flex;
font-size: 32rpx;
font-weight: bold;
color: #333333;
line-height: 32rpx;
.phone {
margin-left: 20rpx;
font-size: 28rpx;
font-weight: 400;
color: #666666;
}
}
.bottom {
display: flex;
margin-top: 24rpx;
justify-content: space-between;
align-items: flex-start;
font-size: 28rpx;
font-weight: 400;
color: #333333;
.address{
max-width: 500rpx;
line-height: 40rpx;
}
}
.default {
border-top: 2rpx solid #F4F5F7;
margin-top: 22rpx;
padding-top: 30rpx;
.txt {
margin-left: 12rpx;
font-size: 28rpx;
font-weight: 400;
color: #333333;
line-height: 28rpx;
}
}
} }
</style> </style>
<template> <template>
<view class="u-flex det-wrap"> <view class="u-flex det-wrap">
<view class="content"> <view class="content" v-if="lists.length > 0">
<scroll-view v-if="lists.length > 0" style="height: 100%;" scroll-y="true"> <scroll-view style="height: 100%;" scroll-y="true">
<select-parts <select-parts
v-for="(item, index) in lists" v-for="(item, index) in lists"
:key="index" :key="index"
...@@ -12,10 +12,18 @@ ...@@ -12,10 +12,18 @@
@apply="apply(index)" @apply="apply(index)"
></select-parts> ></select-parts>
</scroll-view> </scroll-view>
<view v-else class="empty">暂无可用备件</view>
</view> </view>
<view class="bar"> <view v-else class="u-flex-col u-col-center empty">
<view class="sold-out">
<u-image :src="qnFile('SoldOut.png')" width="374" mode="widthFix">
<view slot="error" style="font-size: 24rpx;">加载失败</view>
</u-image>
</view>
<view class="message">当前无可用备件</view>
</view>
<view class="bar" v-if="lists.length > 0">
<submit-bar <submit-bar
:partNum="partNum" :partNum="partNum"
:num="num" :num="num"
...@@ -62,18 +70,6 @@ ...@@ -62,18 +70,6 @@
img: "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png", img: "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png",
checked: false, checked: false,
disabled: true disabled: true
},
{
id: 1,
name: "正泰漏保",
no: 'NO.202006170015NO.202006170015',
desc: '这个充电桩的简介可以写的长一点',
num: 1,
min: 1,
max: 100,
img: "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png",
checked: false,
disabled: false
} }
], ],
val: [] val: []
...@@ -117,6 +113,9 @@ ...@@ -117,6 +113,9 @@
}, },
submit() { submit() {
console.log('submit') console.log('submit')
},
qnFile(src) {
return process.uniEnv.qn_base_url + src
} }
} }
} }
...@@ -129,18 +128,20 @@ ...@@ -129,18 +128,20 @@
height: 100vh; height: 100vh;
.content { .content {
border-radius: 12rpx; border-radius: 12rpx;
padding: 10rpx; padding: 10rpx 10rpx 0 10rpx;
width: 100%; width: 100%;
.empty {
text-align: center;
font-size: 26rpx;
color: #aaa;
}
flex: 1; flex: 1;
overflow-y: auto; overflow-y: auto;
} }
.bar { .bar {
width: 100%; width: 100%;
border-top: 1px solid #F4F5F7;
}
.empty {
flex: 1;
justify-content: center;
font-size: 26rpx;
color: #aaa;
} }
} }
</style> </style>
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
:clearabled="true" :clearabled="true"
:action-style="searchStyle" :action-style="searchStyle"
bg-color="#fff" bg-color="#fff"
v-model="keyword"
@custom="searchParts" @custom="searchParts"
@search="searchParts" @search="searchParts"
></u-search> ></u-search>
...@@ -13,7 +14,7 @@ ...@@ -13,7 +14,7 @@
<view class="categary"> <view class="categary">
<view class="u-flex u-col-center"> <view class="u-flex u-col-center">
<picker mode="selector" :value="categaryIndex" range-key="label" :range="categary" @click="show = true" @change="changeCategary"> <picker mode="selector" :value="categaryIndex" range-key="label" :range="categary" @click="show = true" @change="changeCategary">
<view class="txt">{{categrayName || '请选择'}}</view> <view class="txt">{{categary[categaryIndex].label || '请选择'}}</view>
</picker> </picker>
<u-icon class="input-icon" color="#2272FF" :name="show ? 'arrow-up' : 'arrow-down'"></u-icon> <u-icon class="input-icon" color="#2272FF" :name="show ? 'arrow-up' : 'arrow-down'"></u-icon>
</view> </view>
...@@ -28,7 +29,7 @@ ...@@ -28,7 +29,7 @@
class="u-flex" class="u-flex"
:scroll-into-view="scrollId" :scroll-into-view="scrollId"
> >
<view :id="`brand${item.id}`" :class="['label-title', { selected: item.id === brandId }]" v-for="(item, index) in brand" :key="index" @click="selectBrand(item)">{{ item.label }}</view> <view :id="`brand${item.brandId}`" :class="['label-title', { selected: item.brandId === brandId }]" v-for="(item, index) in brand" :key="index" @click="selectBrand(item, index)">{{ item.label }}</view>
</scroll-view> </scroll-view>
</view> </view>
<view class="more u-flex"> <view class="more u-flex">
...@@ -66,7 +67,7 @@ ...@@ -66,7 +67,7 @@
<submit-bar <submit-bar
:partNum="partNum" :partNum="partNum"
:num="num" :num="num"
:btnStatus="btnStatus" :btnStatus="partNum > 0"
:show-checked="false" :show-checked="false"
submit-txt="去提交" submit-txt="去提交"
@submit="submit" @submit="submit"
...@@ -76,132 +77,6 @@ ...@@ -76,132 +77,6 @@
</template> </template>
<script> <script>
const categary = [
{
id: 1,
label: "充电桩",
value: 1,
children: [
{
id: 1,
parentId: 1,
label: "沃尔沃",
},
{
id: 2,
parentId: 1,
label: "宝马",
},
{
id: 3,
parentId: 1,
label: "奔驰",
},
{
id: 4,
parentId: 1,
label: "奥迪",
},
{
id: 5,
parentId: 1,
label: "保时捷",
},
],
},
{
id: 2,
label: "空调",
value: 2,
children: [
{
id: 3,
parentId: 2,
label: "美的",
},
{
id: 4,
parentId: 2,
label: "格力",
},
],
},
];
const lists = [
{
id: 1,
name: "正泰漏保",
no: 'NO.202006170015',
desc: '这个空开盒子和其他的空开有什么不一样,这里可以写一下',
num: 1,
min: 1,
max: 100,
img: "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png",
checked: false,
disabled: true
},
{
id: 1,
name: "挚达广汽充电桩",
no: 'NO.202006170014',
desc: '这个空开盒子和其他的空开有什么不一样,这里可以写一下',
num: 3,
min: 1,
max: 5,
img: "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png",
checked: false,
disabled: true
},
{
id: 1,
name: "正泰漏保",
no: 'NO.202006170015NO.202006170015',
desc: '这个充电桩的简介可以写的长一点',
num: 1,
min: 1,
max: 100,
img: "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png",
checked: false,
disabled: false
},
{
id: 1,
name: "正泰漏保",
no: 'NO.202006170015NO.202006170015',
desc: '这个充电桩的简介可以写的长一点',
num: 1,
min: 1,
max: 100,
img: "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png",
checked: false,
disabled: false
},
{
id: 1,
name: "正泰漏保",
no: 'NO.202006170015NO.202006170015',
desc: '这个充电桩的简介可以写的长一点',
num: 1,
min: 1,
max: 100,
img: "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png",
checked: false,
disabled: false
},
{
id: 1,
name: "正泰漏保",
no: 'NO.202006170015NO.202006170015',
desc: '这个充电桩的简介可以写的长一点',
num: 1,
min: 1,
max: 100,
img: "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png",
checked: false,
disabled: false
}
];
import selectParts from "@/components/select-parts/index" import selectParts from "@/components/select-parts/index"
import submitBar from "@/components/submit-bar/index" import submitBar from "@/components/submit-bar/index"
...@@ -212,18 +87,19 @@ export default { ...@@ -212,18 +87,19 @@ export default {
}, },
data() { data() {
return { return {
keyword: '',
show: false, show: false,
categary: categary, categary: [],
brand: [], brand: [],
categaryIndex: 0, categaryIndex: 0,
categaryId: '',
brandIndex: 0, brandIndex: 0,
brandId: '', brandId: '',
scrollId: '', scrollId: '',
loadStatus: "loadmore", loadStatus: "loadmore",
lists: lists, lists: [],
size: 5, pageSize: 20,
page: 1, pageNumber: 1
count: 1
}; };
}, },
computed: { computed: {
...@@ -232,73 +108,133 @@ export default { ...@@ -232,73 +108,133 @@ export default {
color: "#2272FF" color: "#2272FF"
}; };
}, },
categrayName() {
return this.categary[this.categaryIndex].label
},
// 配件数 // 配件数
partNum() { partNum() {
return this.lists.reduce((counter, { checked }) => checked ? counter += 1 : counter, 0) return this.lists.reduce((counter, item) => !item.disabled && item.quantity > 0 ? counter += 1 : counter, 0)
}, },
// 总数 // 总数
num() { num() {
return this.lists.reduce((counter, { checked, num }) => checked ? counter += num : counter, 0) return this.lists.reduce((counter, { disabled, quantity }) => !disabled ? counter += quantity : counter, 0)
},
// 按钮状态
btnStatus() {
const count = this.lists.reduce((counter, { checked }) => checked ? counter += 1 : counter, 0)
return count > 0 || false
} }
}, },
created() { created() {
this.brand = this.categary[0].children this.getCategaryList()
}, },
methods: { methods: {
// 获取品类
getCategaryList() {
this.$u.api.getCategoryList().then(res => {
if (res.code === 200) {
const data = res.data
this.categary = data.list ? data.list.map(v => {
v.label = v.categoryName
return v
}) : []
this.categaryId = this.categary[0].categoryId
this.getBrandList()
}
})
},
// 获取品牌
getBrandList() {
this.$u.api.getBrandList({categoryId: this.categaryId}).then(res => {
if (res.code === 200) {
const data = res.data
this.brand = data.list ? data.list.map(v => {
v.label = v.brandName
return v
}) : []
this.brandId = this.brand[0].brandId
this.lists = []
this.getPartsList()
}
})
},
// 获取配件列表
getPartsList() { getPartsList() {
this.page++; this.page++;
this.loadStatus = "loading"; this.loadStatus = "loading";
const data = [] const params = {
// 模拟加载更多效果 pageNumber: this.pageNumber,
setTimeout(() => { pageSize: this.pageSize,
if (lists.length < this.size || this.count === 3) { categoryId: this.categaryId,
this.loadStatus = "nomore"; brandId: this.brandId,
} else { keyword: this.keyword
this.lists = this.lists.concat(lists); }
this.count++ this.$u.api.getPartsList(params).then(res => {
if (res.code === 200) {
const data = res.data
if (data.length > 0) {
const lists = data.map(v => {
v.quantity = 0
v.disabled = true
v.max = 999
return v
})
this.lists = this.lists.concat(lists)
this.pageNumber++
this.loadStatus = "loadmore" this.loadStatus = "loadmore"
} else {
this.loadStatus = "nomore"
}
} }
}, 1000) })
}, },
// 搜索配件
searchParts(val) { searchParts(val) {
console.log("val", val); this.keyword = val
this.lists = []
this.getPartsList()
}, },
// 选择品类
changeCategary(data) { changeCategary(data) {
this.categaryIndex = data.detail.value this.categaryIndex = data.detail.value
this.brand = this.categary[this.categaryIndex].children || [] this.categaryId = this.categary[this.categaryIndex || 0].categoryId
this.brandIndex = '' this.brandIndex = ''
this.show = false this.show = false
this.getBrandList()
this.getPartsList()
}, },
// 下拉选择品牌
changeBrand(data) { changeBrand(data) {
this.brandIndex = data.detail.value this.brandIndex = data.detail.value
this.brandId = this.brand[this.brandIndex].id this.brandId = this.brand[this.brandIndex].brandId
this.scrollId = `brand${this.brandId}` this.scrollId = `brand${this.brandId}`
this.lists = []
this.getPartsList()
}, },
selectBrand(item) { // 点击选择品牌
selectBrand(item, index) {
this.scrollId = '' this.scrollId = ''
this.brandIndex = '' this.brandIndex = index
this.brandId = item.id this.brandId = item.brandId
this.lists = []
this.getPartsList()
}, },
// 加载更多
loadMore() { loadMore() {
if (this.loadStatus !== "nomore") { if (this.loadStatus !== "nomore") {
this.getPartsList(); this.getPartsList();
} }
}, },
// 加入申请
apply(index) { apply(index) {
this.$set(this.lists[index], 'disabled', false) this.$set(this.lists[index], 'disabled', false)
}, },
// 改变数量
numChange(val, index) { numChange(val, index) {
this.$set(this.lists[index], 'num', val) this.$set(this.lists[index], 'quantity', val)
}, },
// 提交
submit() { submit() {
const lists = this.lists.filter(v => !v.disabled).map(v => {
return {
part_id: v.id,
quantity: v.quantity
}
})
console.log("lists", lists)
console.log('submit') console.log('submit')
} }
}, },
......
...@@ -40,16 +40,7 @@ ...@@ -40,16 +40,7 @@
></u-subsection> ></u-subsection>
</view> </view>
<view class="body"> <view class="body">
<view class="item" @click="$u.throttle(editSite, 500)"> <w-address :info="addressInfo" @editSite="editSite" />
<view class="userinfo u-flex">
<view class="name">{{formatName}}</view>
<view class="mobile">{{formatMobile}}</view>
</view>
<view class="rangeinfo u-flex u-row-between u-col-top">
<view class="txt">{{formatAddress}}</view>
<u-icon custom-prefix="wxh" name="pen" size="32"></u-icon>
</view>
</view>
</view> </view>
</view> </view>
</view> </view>
...@@ -60,6 +51,7 @@ ...@@ -60,6 +51,7 @@
</template> </template>
<script> <script>
import Utils from '@/utils/callUtils.js'
import SelectParts from '@/components/select-parts/adjust.vue' import SelectParts from '@/components/select-parts/adjust.vue'
export default { export default {
components: { components: {
...@@ -74,8 +66,12 @@ export default { ...@@ -74,8 +66,12 @@ export default {
remark: '', remark: '',
siteTypes: [{name: '我的地址'}, {name: '客户地址'}], siteTypes: [{name: '我的地址'}, {name: '客户地址'}],
curType: 0, curType: 0,
mine: {}, mine: {
customer: {}, name: '', mobile: '', address: '', region: []
},
customer: {
name: '', mobile: '', address: '', region: []
},
}; };
}, },
computed: { computed: {
...@@ -92,78 +88,35 @@ export default { ...@@ -92,78 +88,35 @@ export default {
fontWeight: 600, fontWeight: 600,
} }
}, },
formatName() { addressInfo() {
let name = '' return this.curType ? this.customer : this.mine
if(this.curType) {
name = this.customer && this.customer.name
} else {
name = this.mine && this.mine.name
}
if(this.$u.test.isEmpty(name)) {
return '--'
}
return name
},
formatMobile() {
let mobile = ''
if(this.curType) {
mobile = this.customer && this.customer.mobile
} else {
mobile = this.mine && this.mine.mobile
}
if(this.$u.test.isEmpty(mobile)) {
return '--'
}
if(mobile.length == 11) {
let tmps = []
tmps[0] = mobile.slice(0, 3)
tmps[1] = mobile.slice(3, 7)
tmps[2] = mobile.slice(7)
return tmps.join(" ")
} else {
return mobile
}
},
formatAddress() {
let address = ''
if(this.curType) {
address = this.customer && this.customer.address
} else {
address = this.mine && this.mine.address
}
if(this.$u.test.isEmpty(address)) {
return '--'
}
return address
}, },
}, },
onLoad(e) { onLoad(e) {
this.orderId = e && Number(e.orderId) || 0 this.orderId = e && Number(e.orderId) || 0
this.initData() this.initData()
}, },
mounted() {
Utils.$on('update-site',(site)=>{
this.updateSite(site);
})
},
methods: { methods: {
initData() { initData() {
this.loadMineAddress() this.loadMineAddress()
this.loadOrderInfo() this.loadOrderInfo()
}, },
loadMineAddress() { loadMineAddress() {
this.mine = { this.mine.address = "广东省深圳市宝安区宝城67区留芳路6号庭威产业园3栋10C"
name: '王先生', this.mine.region = ['广东省', '深圳市', '宝安区']
mobile: '13045861456',
address: '宝城67区留芳路6号庭威产业园3栋10C',
range: ['广东省', '深圳市', '宝安区'],
code: ['44','4403','440306'],
}
this.$u.api.getSiteAddress().then((res) => { this.$u.api.getSiteAddress().then((res) => {
if(res.code == 200 && res.data) { if(res.code == 200 && res.data) {
let name = this.vuex_settled && this.vuex_settled.record && (this.vuex_settled.record.id_card_name || this.vuex_settled.record.nickname) this.mine.address = res.data.address
let mobile = this.vuex_settled && this.vuex_settled.record && this.vuex_settled.record.mobile this.mine.region = [
this.mine = { res.data.provinceName,
name: name, res.data.cityName,
mobile: mobile, res.data.districtName
address: res.data.address, ]
range: [res.data.provinceName, res.data.cityName, res.data.districtName, res.data.streetName],
}
} }
}) })
}, },
...@@ -181,23 +134,25 @@ export default { ...@@ -181,23 +134,25 @@ export default {
if(this.$u.test.isEmpty(this.order)) { if(this.$u.test.isEmpty(this.order)) {
this.customer = {} this.customer = {}
} else { } else {
console.log("order", this.order) // this.mine.name = this.order.maintainWorkerName
const range = [ // this.mine.mobile = this.order.maintainWorkerPhone
this.mine.name = '王先生'
this.mine.mobile = '13045861456'
const region = [
this.order.contactProvinceText, this.order.contactProvinceText,
this.order.contactCityText, this.order.contactCityText,
this.order.contactCommunityText, this.order.contactCommunityText,
this.order.contactStreetText,
] ]
this.customer = { this.customer = {
name: this.order.contactName, name: this.order.contactName,
mobile: this.order.contactPhone, mobile: this.order.contactPhone,
address: range.join("") + this.order.contactAddress, address: region.join("") + this.order.contactStreetText + this.order.contactAddress,
range: range, region: region,
code: [ code: [
this.order.contactProvince, this.order.contactProvince,
this.order.contactCity, this.order.contactCity,
this.order.contactCommunity, this.order.contactCommunity,
this.order.contactStreet,
] ]
} }
} }
...@@ -217,10 +172,28 @@ export default { ...@@ -217,10 +172,28 @@ export default {
this.curType = index this.curType = index
}, },
editSite() { editSite() {
let region = this.addressInfo.region.join('')
let address = this.addressInfo.address
if(this.$u.test.contains(address, region)) {
address = address.replace(region, '')
}
let params = {
type: 'select',
name: this.addressInfo.name,
mobile: this.addressInfo.mobile,
address: address,
region: this.addressInfo.region.join('-'),
code: this.addressInfo.code && this.addressInfo.code.join('-'),
};
console.log("editSite", params)
this.$u.route({ this.$u.route({
url: "pages/mine/address/addSite" url: "pages/mine/address/addSite",
params: params
}) })
}, },
updateSite(site) {
console.log("updateSite", site)
},
addParts() { addParts() {
this.$u.route({ this.$u.route({
url: "pages/parts/addParts" url: "pages/parts/addParts"
...@@ -290,44 +263,17 @@ export default { ...@@ -290,44 +263,17 @@ export default {
padding-top: -6rpx; padding-top: -6rpx;
padding-bottom: 34rpx; padding-bottom: 34rpx;
border-bottom: 2rpx solid #F4F5F7; border-bottom: 2rpx solid #F4F5F7;
/deep/ .u-subsection { // /deep/ .u-subsection {
width: 372rpx; // width: 372rpx;
.u-item-bg { // .u-item-bg {
border-radius: 32rpx !important; // border-radius: 32rpx !important;
} // }
} // }
} }
.body { .body {
.item { padding-top: 10rpx;
padding: 10rpx 0 52rpx 0; padding-bottom: 52rpx;
.userinfo{
.name{
height: 92rpx;
font-size: 32rpx;
font-weight: bold;
color: #333333;
line-height: 92rpx;
}
.mobile {
margin-left: 20rpx;
height: 92rpx;
font-size: 28rpx;
font-weight: 400;
color: #666666;
line-height: 92rpx;
}
}
.rangeinfo {
.txt {
width: 500rpx;
font-size: 28rpx;
font-weight: 400;
color: #333333;
line-height: 34rpx;
word-wrap: break-word;
}
}
}
} }
} }
} }
......
import Vue from 'vue'
export default new Vue
\ No newline at end of file
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