Commit f104a484 authored by 李超鹏's avatar 李超鹏

type:update

scope: self
body: 完工项 工艺、材料功能
parent 9d53f76b
...@@ -78,7 +78,7 @@ let orderApiFun = function(vm){ ...@@ -78,7 +78,7 @@ let orderApiFun = function(vm){
* 获取师傅水印 or 默认水印 * 获取师傅水印 or 默认水印
*/ */
let getWatermark = async (params = {}) => await vm.$u.get(prefix + vm.vuex_token + '/photo/watermark', params); let getWatermark = async (params = {}) => await vm.$u.get(prefix + vm.vuex_token + '/photo/watermark', params);
/** /**
* 保存师傅水印 * 保存师傅水印
*/ */
...@@ -115,11 +115,16 @@ let orderApiFun = function(vm){ ...@@ -115,11 +115,16 @@ let orderApiFun = function(vm){
*/ */
let getMeasure= async (params = {}) => await vm.$u.get('wxh-worker-rest/rest/service/'+ vm.vuex_token+'/measure/queryMeasureItems', params); let getMeasure= async (params = {}) => await vm.$u.get('wxh-worker-rest/rest/service/'+ vm.vuex_token+'/measure/queryMeasureItems', params);
/**
* 查询工单材信息
*/
let getOrderMaterial= async (orderId) => await vm.$u.get('/wxh-cloud-rest/rest/thirdparty/shzhida/material/' + orderId);
/** /**
* 保存售后记录 * 保存售后记录
*/ */
let saveCompleteData = async (params = {},orderId) => await vm.$u.post(prefix+ vm.vuex_token+'/order/'+ orderId +'/maintain/saveMaintainInfoV2', params); let saveCompleteData = async (params = {},orderId) => await vm.$u.post(prefix+ vm.vuex_token+'/order/'+ orderId +'/maintain/saveMaintainInfoV2', params);
/** /**
* 保内工单完工 * 保内工单完工
*/ */
...@@ -161,6 +166,7 @@ let orderApiFun = function(vm){ ...@@ -161,6 +166,7 @@ let orderApiFun = function(vm){
getSignDistance, getSignDistance,
getCompleteConfigAndData, getCompleteConfigAndData,
getMeasure, getMeasure,
getOrderMaterial,
saveCompleteData, saveCompleteData,
inOrderFinish, inOrderFinish,
outOrderFinish, outOrderFinish,
......
<!-- ******************* 输入框 ******************* -->
<template>
<view>
<view class="list u-flex u-row-between">
<image class="item-image" :src="mixingImage" v-if="item.required"></image>
<view class="u-m-r-20">{{item.fieldsTitle}}</view>
<view class="u-flex-1 location-name" @click="toMaterialPage">
<u-icon name="map" color="#2979ff" size="30"></u-icon>请选择
</view>
</view>
<!-- <view class="u-flex-1 location">{{valueTxt || '正在获取中...'}}</view> -->
</view>
</template>
<script>
import arrMixin from './arrMixin'
export default {
name: 'XhInput', // 新建 input
components: {},
mixins: [arrMixin],
props: {
placeholder: {
type: String,
default: '请输入'
},
orderId: {
type: String,
default: '请输入'
},
},
data() {
return {
maxlength: 140,
}
},
computed: {
mixingImage() {
return process.uniEnv.qn_base_url + 'mixing.png'
}
},
watch: {},
mounted() {},
methods: {
toMaterialPage(){
let self = this
uni.navigateTo({
url: 'pages/order/material?orderId='+this.orderId + '&fieldName='+ this.item.fieldsName,
// 接口调用成功的回调函数,即跳转到B页面 test.vue 后的回调函数
success: function(res) {
// 通过eventChannel向被打开页面传送数据
res.eventChannel.emit('showMaterialData', self.dataValue);
}
})
},
}
}
</script>
<style scoped>
.required {
padding-right: 10rpx;
font-size: 28rpx;
line-height: 40rpx;
color: #fa3534;
}
.item-image {
width: 24rpx;
height: 24rpx;
margin-right: 10rpx;
}
.location-name {
color: #2272FF;
text-align: right;
}
.location {
background: #F4F5F7;
padding: 10rpx 20rpx;
border-radius: 12rpx;
}
</style>
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<view class="class-bd"> <view class="class-bd">
<u-form-item v-for="(item,itemIndex) in groupItem.items" :key="itemIndex" label-position="top" <u-form-item v-for="(item,itemIndex) in groupItem.items" :key="itemIndex" label-position="top"
:prop="item.fieldsName" :border-bottom="false" v-show="item.fieldsId != 200 || show200"> :prop="item.fieldsName" :border-bottom="false" v-show="item.fieldsId != 200 || show200">
<view :class="[{'label-bold': groupItem.name === '基本信息'}, 'label']" v-if="typeToComponentType(item.fieldsType)!=='location'"> <view :class="[{'label-bold': groupItem.name === '基本信息'}, 'label']" v-if="typeToComponentType(item.fieldsType)!=='location'&&typeToComponentType(item.fieldsType)!=='form'">
<image class="item-image" :src="mixingImage" v-if="item.required"></image> <image class="item-image" :src="mixingImage" v-if="item.required"></image>
{{item.fieldsTitle}} {{item.fieldsTitle}}
</view> </view>
...@@ -73,6 +73,10 @@ ...@@ -73,6 +73,10 @@
:groupIndex="groupIndex" :itemIndex="itemIndex" :item="item" :value='form[item.fieldsName] || ""' :groupIndex="groupIndex" :itemIndex="itemIndex" :item="item" :value='form[item.fieldsName] || ""'
@value-change="fieldValueChange"> @value-change="fieldValueChange">
</xh-time> </xh-time>
<xh-service-more v-else-if="typeToComponentType(item.fieldsType)==='form'"
:groupIndex="groupIndex" :itemIndex="itemIndex" :item="item" :order-id="orderId" :value='form[item.fieldsName] || ""'
@value-change="fieldValueChange">
</xh-service-more>
</template> </template>
</u-form-item> </u-form-item>
</view> </view>
...@@ -114,6 +118,7 @@ ...@@ -114,6 +118,7 @@
import XhPicker from '@/components/createCom/XhPicker.vue' import XhPicker from '@/components/createCom/XhPicker.vue'
import XhTime from '@/components/createCom/XhTime.vue' import XhTime from '@/components/createCom/XhTime.vue'
import XhServiceMeasure from '@/components/createCom/XhServiceMeasure.vue' import XhServiceMeasure from '@/components/createCom/XhServiceMeasure.vue'
import XhServiceMore from "../../components/createCom/XhServiceMore";
// import XhRadio from '@/components/createCom/XhRadio.vue' // import XhRadio from '@/components/createCom/XhRadio.vue'
export default { export default {
data() { data() {
...@@ -185,7 +190,8 @@ ...@@ -185,7 +190,8 @@
XhScan, XhScan,
XhPicker, XhPicker,
XhTime, XhTime,
XhServiceMeasure XhServiceMeasure,
XhServiceMore
}, },
created() { created() {
// console.log(allComponents,'allComponents') // console.log(allComponents,'allComponents')
...@@ -409,6 +415,11 @@ ...@@ -409,6 +415,11 @@
this.getMenuItemTop() this.getMenuItemTop()
}) })
}, },
setData(data){// 通过页面设置数据
Object.keys(data).forEach(key => {
this.$set(this.form,key,data[key])
})
},
// 字段的值更新 // 字段的值更新
fieldValueChange(data) { fieldValueChange(data) {
const groupItem = this.list[this.tabIndex].items[data.groupIndex] const groupItem = this.list[this.tabIndex].items[data.groupIndex]
...@@ -496,6 +507,9 @@ ...@@ -496,6 +507,9 @@
case 'date': case 'date':
formType = 'time' formType = 'time'
break break
case 'form':
formType = 'form'
break
} }
return formType return formType
}, },
......
<template> <template>
<view class="mtr-content"> <view class="mtr-content">
<view class="content-view"> <view class="content-view">
<!-- 材料列表 --> <!-- 材料列表 -->
<view class="mtr-tab"> <view class="mtr-tab">
<u-table align="center" border-color="#FFFFFF" color="#333333" font-size="rpx" :th-style="thStyle" <u-table align="center" border-color="#FFFFFF" color="#333333" font-size="rpx" :th-style="thStyle"
padding="0"> padding="0">
<u-tr class="u-tr"> <u-tr class="u-tr">
<u-th class="u-th content-tab-th" v-for="(value, key) in titles" :key="key" width="auto"> <u-th class="u-th content-tab-th" v-for="(value, key) in titles" :key="key" width="auto">
<text :class="['tab-th-txt', {'left': key == firstKey}]">{{value}}</text> <text :class="['tab-th-txt', {'left': key == firstKey}]">{{value}}</text>
</u-th> </u-th>
</u-tr> </u-tr>
<view class="line-view"></view> <view class="line-view"></view>
<u-tr class="u-tr" v-for="(item, index) in list" :key="index"> <u-tr class="u-tr" v-for="(item, index) in list" :key="index">
<u-td class="u-td" v-for="(value, key) in titles" :key="key"> <u-td class="u-td" v-for="(value, key) in titles" :key="key">
<text :class="['tab-th-txt', {'left': key == firstKey}]">{{item[key]}}</text> <text :class="['tab-th-txt', {'left': key == firstKey}]">{{item[key]}}</text>
</u-td> </u-td>
</u-tr> </u-tr>
</u-table> </u-table>
</view> </view>
<!-- 其他 --> <!-- 其他 -->
<view class="mtr-other"> <view class="mtr-other">
<view class="line-view"></view> <view class="line-view"></view>
<view class="other-space"> <view class="other-space">
<text>其他</text> <text>其他</text>
<image class="image-view" :src="addImage" @click="handleAdd"></image> <image class="image-view" :src="addImage" @click="handleAdd"></image>
</view> </view>
<view v-if="other.length > 0" class="other-content"> <view v-if="other.length > 0" class="other-content">
<view class="other-space" v-for="(item, index) in other" :key="index"> <view class="other-space" v-for="(item, index) in other" :key="index">
<view class="input-view"> <view class="input-view">
<view class="other-space"> <view class="other-space">
<text class="input-title">说明:</text> <text class="input-title">说明:</text>
<view class="input-content"> <view class="input-content">
<u-input v-model="item.title" :clearable="false" placeholder-style="color:#999999;font-size:26rpx" /> <u-input v-model="item.otherExplain" :clearable="false" placeholder-style="color:#999999;font-size:26rpx" />
</view> </view>
</view> </view>
<view class="other-space"> <view class="other-space">
<text class="input-title">金额:</text> <text class="input-title">金额:</text>
<view class="input-content"> <view class="input-content">
<u-input v-model="item.value" type="number" :clearable="false" placeholder-style="color:#999999;font-size:26rpx" /> <u-input v-model="item.extraAmt" type="number" :clearable="false" placeholder-style="color:#999999;font-size:26rpx" />
</view> </view>
</view> </view>
</view> </view>
<image class="image-view" :src="subtractImage" @click="handleSubtract"></image> <image class="image-view" :src="subtractImage" @click="handleSubtract"></image>
</view> </view>
</view> </view>
<view class="other-space"> <view class="other-space">
<text>超出金额</text> <text>超出金额</text>
<text>{{money}}元</text> <text>{{money}}元</text>
</view> </view>
</view> </view>
</view>
<!-- 底部确定按钮 -->
<view class="bottom-view">
<u-button class="sure-button" type="primary" shape="circle" @click="handleSure" :custom-style="buttonStyle">
确定
</u-button>
</view> </view>
<!-- 底部确定按钮 --> </view>
<view class="bottom-view"> </template>
<u-button class="sure-button" type="primary" shape="circle" @click="handleSure" :custom-style="buttonStyle">
确定 <script>
</u-button> export default {
</view> data() {
</view> return {
</template> orderId:'',
fieldName:'materialList',
<script> list: [], // 材料列表
export default { other: [], // 其他列表
data() { };
return { },
list: [], // 材料列表 computed: {
other: [], // 其他列表 buttonStyle() {
}; return {
}, width: "600rpx",
computed: { height: "104rpx",
buttonStyle() { "font-size": "32rpx",
return { "font-weight": "bold",
width: "600rpx", };
height: "104rpx", },
"font-size": "32rpx", titles() {
"font-weight": "bold", if(this.isMaterial){
}; return {
}, matName: '材料名称',
titles() { matUnit: '单位',
return { freeLength: '免费量',
name: '材料名称', unitAmt: '单价/元',
unit: '单位', useLength: '用量'
freeAmount: '免费量', }
price: '单价/元', }else{
consumption: '预计用量' return {
} matName: '工艺名称',
}, matUnit: '单位',
thStyle() { freeLength: '免费量',
return { unitAmt: '单价/元',
'font-weight': 'bold' useLength: '用量'
} }
}, }
firstKey() { },
return Object.keys(this.titles)[0] thStyle() {
}, return {
subtractImage() { 'font-weight': 'bold'
return process.uniEnv.qn_base_url + 'qxiao.png' }
}, },
addImage() { firstKey() {
return process.uniEnv.qn_base_url + 'tianjia.png' return Object.keys(this.titles)[0]
}, },
money() { // 总额 subtractImage() {
var amount = 0 return process.uniEnv.qn_base_url + 'qxiao.png'
},
addImage() {
return process.uniEnv.qn_base_url + 'tianjia.png'
},
money() { // 总额
var amount = 0
for (var item of this.list) { for (var item of this.list) {
if (Number(item.consumption) && Number(item.freeAmount) && Number(item.price)) { if (Number(item.useLength) && Number(item.freeLength) && Number(item.unitAmt)) {
amount += Math.max(Number(item.consumption) - Number(item.freeAmount), 0) * Number(item.price) amount += Math.max(Number(item.useLength) - Number(item.freeLength), 0) * Number(item.unitAmt)
} }
} }
for (var item of this.other) { for (var item of this.other) {
if (item.value && Number(item.value)) { if (item.freeMount && Number(item.freeMount)) {
amount += Number(item.value) amount += Number(item.freeMount)
} }
}
} return amount
return amount },
} isMaterial(){
}, return this.fieldName === 'materialList'
created() { },
// 测试数据 isCraft(){
console.log('0000') return this.fieldName === 'craftList'
for (var i = 0; i < 20; i++) { },
this.list.push({ priceType(){
name: '开关发大法师放大范德萨发大水', return this.isMaterial?"01":"02"
unit: '个', },
freeAmount: '1', },
price: '45.0', onLoad(option) {
consumption: '4', this.orderId = option.orderId
}) this.fieldName = option.fieldName
} const eventChannel = this.getOpenerEventChannel();
}, let self = this
eventChannel.on('showMaterialData', function(data) {
if(!data || data.length === 0){
self.getMaterialData()
}else{
self.formatServiceMoreList(data)
}
});
},
created() {
},
mounted() {
},
methods: { methods: {
/* 其他添加新的 */ getMaterialData(){
handleAdd() { let self = this
this.other.push({ self.$u.api.getCompleteConfigAndData(self.orderId).then((res) => {
title: '', if (res.code !== 200) {
value: '' console.log(result.data.message)
}) return
}
self.formatServiceMoreList(res.data)
})
// let testData = [{"freeLength":30,"priceTypeName":"","priceType":"01","lastModifiedWhen":"2021-05-11 11:10:27","matNo":"MAT1594085500303","createdWhen":"2021-05-11 11:10:27","extraAmt":0,"matName":"φ32镀锌管","studErp":"","isDel":"N","orderNo":"D20210424296591GQF","createdByName":"李小平","matUnit":"米","useLength":0,"orderMaterialId":"32BDDH67P5BBJGBKQBVXYCoJAA","lastModifiedByName":"李小平","unitAmt":0,"otherExplain":"","matType":"01"},{"freeLength":1,"priceTypeName":"","priceType":"01","lastModifiedWhen":"2021-05-11 11:10:27","matNo":"MAT1594714122500","createdWhen":"2021-05-11 11:10:27","extraAmt":0,"matName":"无标准电表箱","studErp":"","isDel":"N","orderNo":"D20210424296591GQF","createdByName":"李小平","matUnit":"个","useLength":0,"orderMaterialId":"6GXHJEJIZ5FZ7oFESHB26EAYWY","lastModifiedByName":"李小平","unitAmt":0,"otherExplain":"","matType":"01"}]
// self.formatServiceMoreList(testData)
},
formatServiceMoreList(materialCraftsData){
let self = this
materialCraftsData.map(item => {
if (item.priceType === self.priceType) {
item.matType === '04' ? self.other.push(item) : self.list.push(item)
}
})
},
/* 其他添加新的 */
handleAdd() {
this.other.push({
//orderNo:this.formInfo.orderNo,
isDel:'N',
isWebAdd:true,
matName:'其他',
extraAmt:0,
priceType:this.priceType,
matType:'04',
otherExplain:''
})
},
/* 其他删除某个 */
handleSubtract(index) {
this.other.splice(index, 1)
}, },
/* 其他删除某个 */ handleSure() {
handleSubtract(index) { let pages = getCurrentPages();
this.other.splice(index, 1) let prevPage = pages[pages.length - 2]; //上一个页面
}, let data = {}
handleSure() { data[this.fieldName] = this.list.concat(this.other) // 将list合并给上以页面
// 返回总额money prevPage.$vm.setData(data)//直接调用上一个页面的setData()方法,把数据存到上一个页面中去
} uni.navigateBack();
} }
} }
</script> }
</script>
<style lang="scss" scoped>
.mtr-content { <style lang="scss" scoped>
display: flex; .mtr-content {
flex-direction: column; display: flex;
background-color: #F4F5F7; flex-direction: column;
height: 100vh; background-color: #F4F5F7;
height: 100vh;
.content-view {
padding: 30rpx 30rpx 60rpx 30rpx; .content-view {
margin: 20rpx 30rpx; padding: 30rpx 30rpx 60rpx 30rpx;
border-radius: 12rpx; margin: 20rpx 30rpx;
background-color: #FFFFFF; border-radius: 12rpx;
height: 100%; background-color: #FFFFFF;
overflow: auto; height: 100%;
overflow: auto;
.line-view {
background-color: #F4F5F7; .line-view {
height: 2rpx; background-color: #F4F5F7;
margin: 20rpx 0; height: 2rpx;
} margin: 20rpx 0;
}
.mtr-tab {
.tab-th-txt { .mtr-tab {
background-color: #FFFFFF; .tab-th-txt {
padding: 10rpx 0; background-color: #FFFFFF;
padding: 10rpx 0;
&.left {
text-align: left; &.left {
} text-align: left;
} }
} }
}
.mtr-other {
.other-space { .mtr-other {
display: flex; .other-space {
justify-content: space-between; display: flex;
align-items: center; justify-content: space-between;
} align-items: center;
}
.other-content {
margin-bottom: 30rpx; .other-content {
} margin-bottom: 30rpx;
}
.input-view {
padding: 10rpx 30rpx; .input-view {
width: 100%; padding: 10rpx 30rpx;
border-radius: 12rpx; width: 100%;
border: 1px #F4F5F7 solid; border-radius: 12rpx;
margin-bottom: 30rpx; border: 1px #F4F5F7 solid;
margin-bottom: 30rpx;
.input-title {
width: 80rpx; .input-title {
flex-shrink: 0; width: 80rpx;
color: #333333; flex-shrink: 0;
font-size: 26rpx; color: #333333;
} font-size: 26rpx;
}
.input-content {
width: 100%; .input-content {
} width: 100%;
} }
}
.image-view {
width: 52rpx; .image-view {
height: 52rpx; width: 52rpx;
flex-shrink: 0; height: 52rpx;
margin: 30rpx 0 30rpx 30rpx; flex-shrink: 0;
} margin: 30rpx 0 30rpx 30rpx;
} }
} }
}
.bottom-view {
margin-bottom: 44rpx; .bottom-view {
margin-top: 10rpx; margin-bottom: 44rpx;
height: 104rpx; margin-top: 10rpx;
} height: 104rpx;
} }
}
</style> </style>
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