Commit ae151497 authored by Morson's avatar Morson

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

parents c88cd3e4 0deb7b6f
...@@ -32,13 +32,13 @@ ...@@ -32,13 +32,13 @@
<script> <script>
import adjustParts from "@/components/select-parts/adjust" import adjustParts from "@/components/select-parts/adjust"
import arrMixin from './arrMixin' import stringMixin from './stringMixin'
export default { export default {
name: 'XhParts', name: 'XhParts',
components: { components: {
adjustParts adjustParts
}, },
mixins: [arrMixin], mixins: [stringMixin],
props: { props: {
orderId: { orderId: {
type: String, type: String,
...@@ -66,16 +66,16 @@ ...@@ -66,16 +66,16 @@
return process.uniEnv.qn_base_url + 'no_parts.png' return process.uniEnv.qn_base_url + 'no_parts.png'
}, },
}, },
created() { mounted() {
this.getWorkOrderParts() this.getWorkOrderParts()
}, },
methods: { methods: {
getWorkOrderParts() { getWorkOrderParts() {
this.lists = this.dataValue || [] this.lists = JSON.parse(this.dataValue) || []
}, },
partsChange(val, index) { partsChange(val, index) {
this.$set(this.lists[index], 'quantity', val) this.$set(this.lists[index], 'quantity', val)
this.valueChange(this.lists) this.valueChange(JSON.stringify(this.lists))
}, },
valChange(val) { valChange(val) {
val.forEach(v => { val.forEach(v => {
...@@ -86,7 +86,7 @@ ...@@ -86,7 +86,7 @@
this.$set(this.lists, index, v) this.$set(this.lists, index, v)
} }
}) })
this.valueChange(this.lists) this.valueChange(JSON.stringify(this.lists))
}, },
toParts() { toParts() {
uni.navigateTo({ uni.navigateTo({
......
<!-- ******************* 扫码 ******************* --> <!-- ******************* 扫码 ******************* -->
<template> <template>
<view class=""> <view class="">
<view class="u-flex" @click="scanCode"> <view class="u-flex" @click="scanCode">
<view class="txt u-flex-1">扫描二维码(仅挚达充电桩可扫描)</view> <view class="txt u-flex-1">扫描二维码(仅挚达充电桩可扫描)</view>
<u-icon name="arrow-right" color="#666" size="28"></u-icon> <u-icon name="arrow-right" color="#666" size="28"></u-icon>
</view> </view>
<view class="u-flex"> <view class="u-flex">
<u-input class="u-flex-1 input-item" v-model="dataValue" @input="valueChange" type="text" /> <u-input class="u-flex-1 input-item" v-model="dataValue" @input="valueChange" type="text" />
...@@ -23,33 +23,19 @@ ...@@ -23,33 +23,19 @@
return {} return {}
}, },
computed: { computed: {
valueTxt() {
let str = ''
const dataValue = this.dataValue
if(dataValue && dataValue.length>1){
str = '经度:'+dataValue[0]+','+'维度:'+dataValue[1]
}
return str
}
}, },
watch: {}, watch: {},
mounted() {}, mounted() {},
methods: { methods: {
scanCode(type){ scanCode(type){
const self = this const self = this
// qrCode 二维码;barCode 条形码
let scanType = type && [type] || ['qrCode']
uni.scanCode({ uni.scanCode({
// scanType: scanType,
success: function (res) { success: function (res) {
self.dataValue = res.result self.dataValue = res.result
self.valueChange(res.result) self.valueChange(res.result)
} }
}); });
}, }
// setValue(txt) {
// this.valueChange(this.dataValue)
// }
} }
} }
</script> </script>
...@@ -59,10 +45,10 @@ ...@@ -59,10 +45,10 @@
font-size: 28rpx; font-size: 28rpx;
line-height: 40rpx; line-height: 40rpx;
color: #fa3534; color: #fa3534;
} }
.input-item{ .input-item{
background: #F4F5F7; background: #F4F5F7;
border-radius: 12rpx; border-radius: 12rpx;
padding-left: 20rpx; padding-left: 20rpx;
} }
</style> </style>
<template> <template>
<view class="spare-item"> <view class="spare-item">
<view class="left-view"> <view class="left-view">
<u-checkbox v-if="showChecked" icon-size="28" size="40" v-model="check" @change="handleChange" shape="circle"/> <u-checkbox v-if="showChecked" icon-size="28" size="40" v-model="check" @change="handleChange"
<image class="image-view" :src="imageUrl"></image> shape="circle" />
<view class="info-view"> <image class="image-view" :src="imageUrl"></image>
<view class="name-text">{{item.name}}</view> <view class="info-view">
<view>{{remarkText}}</view> <view class="name-text">{{item.name}}</view>
</view> <view>{{remarkText}}</view>
</view> </view>
<view class="count-view"> </view>
<view v-if="showChecked"> <view class="count-view">
<u-number-box v-model="value" :min="item.min || 0" :max="item.max || item[type]" @change="numChange"></u-number-box> <view v-if="showChecked">
</view> <u-number-box v-model="value" :min="item.min || 0" :max="item.max || item[type]" @minus="numChange"
<text v-else>x{{item[type]|| 0}}</text> @plus="numChange" @blur="numChange"></u-number-box>
</view> </view>
</view> <text v-else>x{{item[type]|| 0}}</text>
</template> </view>
</view>
</template>
<script> <script>
export default { export default {
props: { props: {
showChecked: { // 是否显示勾选 showChecked: { // 是否显示勾选
type: Boolean, type: Boolean,
default() { default () {
return false return false
} }
}, },
type: { // 'stock' 仓库; 'quantity' 订单 type: { // 'stock' 仓库; 'quantity' 订单
type: String, type: String,
default: 'quantity' default: 'quantity'
}, },
item: { item: {
type: Object, type: Object,
default() { default () {
return {} return {}
} }
}, },
noteText: { noteText: {
type: String, type: String,
default: '' default: ''
}, },
}, },
data() { data() {
return { return {
value: 0, value: 0, // 选数
check: false, check: false, // 选中
oldCount: 0 oldCount: 0 // 旧选数
} }
}, },
computed: { computed: {
remarkText() { remarkText() {
if (this.item.categoryName || this.item.brandName) { if (this.item.categoryName || this.item.brandName) {
return (this.item.categoryName || '通用') + '-' + (this.item.brandName || '通用') return (this.item.categoryName || '通用') + '-' + (this.item.brandName || '通用')
} else { } else {
return '通用' return '通用'
} }
}, },
imageUrl() { imageUrl() {
return this.item.images ? process.uniEnv.systemUrl.apiUrl + this.item.images.split(',').shift() : this.placeholderImage return this.item.images ? process.uniEnv.systemUrl.apiUrl + this.item.images.split(',').shift() : this
}, .placeholderImage
placeholderImage() { },
return process.uniEnv.qn_base_url + 'morentupian.png' placeholderImage() {
}, return process.uniEnv.qn_base_url + 'morentupian.png'
}, },
watch: { },
showChecked(val) { watch: {
this.oldCount = 0 showChecked(val) {
}, this.oldCount = 0
'item.quantity'(val) { },
this.value = val 'item.quantity'(val) {
}, this.value = val
'item.selected'(val) { },
this.check = val 'item.selected'(val) {
this.value= val ? this.item.stock : 0 this.check = val
}, this.value = val ? this.item.stock : 0
}, },
methods: { },
handleChange(event) { methods: {
this.value= event.value ? this.item.stock : 0 handleChange(event) {
this.$emit('change', event.value) this.value = event.value ? this.item.stock : 0
}, this.oldCount = this.value
numChange(event) { this.$emit('change', event.value)
if (event.value == 0 && this.oldCount > 0) { },
this.check = false numChange(event) {
this.$emit('change', this.check) if (event.value == 0 && this.oldCount > 0) {
} else if (event.value > 0 && this.oldCount == 0) { this.check = false
this.check = true this.$emit('change', this.check)
this.$emit('change', this.check) } else if (event.value > 0 && this.oldCount == 0) {
} this.check = true
this.oldCount = event.value this.$emit('change', this.check)
this.$emit('numChange', event.value) }
}, this.oldCount = event.value
} this.$emit('numChange', event.value)
} },
</script> }
}
<style lang="scss" scoped> </script>
.spare-item {
display: flex; <style lang="scss" scoped>
// width: 100%; .spare-item {
justify-content: space-between; display: flex;
align-items: flex-end; justify-content: space-between;
// padding: 30rpx; align-items: flex-end;
// background-color: #FFFFFF;
// border-radius: 12rpx; .left-view {
.left-view { display: flex;
display: flex; align-items: center;
align-items: center;
.image-view {
.image-view { width: 120rpx;
width: 120rpx; height: 120rpx;
height: 120rpx; margin-right: 20rpx;
margin-right: 20rpx; flex-shrink: 0;
flex-shrink: 0; }
}
.info-view {
.info-view { font-size: 24rpx;
font-size: 24rpx; color: #333333;
color: #333333;
.name-text {
.name-text { font-size: 32rpx;
font-size: 32rpx; font-weight: bold;
font-weight: bold; color: #333333;
color: #333333; margin-bottom: 30rpx;
margin-bottom: 30rpx; }
} }
} }
}
.count-view {
.count-view { font-size: 28rpx;
font-size: 28rpx; color: #333333;
color: #333333; }
}
}
}
</style> </style>
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
</view> </view>
<view class="u-flex right"> <view class="u-flex right">
<view class="right-img"> <view class="right-img">
<u-image :src="info.images" width="200rpx" height="200rpx" /> <u-image :src="info.images || noPartsImage" 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>
...@@ -45,6 +45,11 @@ ...@@ -45,6 +45,11 @@
} }
} }
}, },
computed: {
noPartsImage() {
return process.uniEnv.qn_base_url + 'morentupian.png'
}
},
data() { data() {
return { return {
} }
......
...@@ -78,6 +78,8 @@ ...@@ -78,6 +78,8 @@
v.max = v.stock v.max = v.stock
v.checked = false v.checked = false
v.quantity = v.stock v.quantity = v.stock
const images = v.images ? v.images.split(',') : []
v.images = images[0]
return v return v
}) })
} }
......
...@@ -152,7 +152,6 @@ export default { ...@@ -152,7 +152,6 @@ export default {
this.$u.api.getBrandList({categoryId: this.categaryId}).then(res => { this.$u.api.getBrandList({categoryId: this.categaryId}).then(res => {
if (res.code === 200) { if (res.code === 200) {
const data = res.data const data = res.data
console.log("data", data)
if (data.length > 0) { if (data.length > 0) {
this.brand = data.map(v => { this.brand = data.map(v => {
v.label = v.brandName v.label = v.brandName
...@@ -184,6 +183,8 @@ export default { ...@@ -184,6 +183,8 @@ export default {
v.quantity = 0 v.quantity = 0
v.disabled = true v.disabled = true
v.max = 999 v.max = 999
const images = v.images ? v.images.split(',') : []
v.images = images[0]
return v return v
}) })
this.lists = this.lists.concat(lists) this.lists = this.lists.concat(lists)
......
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