Compare commits

...

2 Commits

5 changed files with 85 additions and 65 deletions

View File

@ -4,22 +4,19 @@
"version" : "0.0",
"configurations" : [
{
"app-plus" :
{
"app-plus" : {
"launchtype" : "local"
},
"default" :
{
"default" : {
"launchtype" : "local"
},
"mp-weixin" :
{
"mp-weixin" : {
"launchtype" : "local"
},
"type" : "uniCloud"
},
{
"playground" : "custom",
"playground" : "standard",
"type" : "uni-app:app-android"
}
]

View File

@ -3,7 +3,8 @@ module.exports = {
// baseUrl: 'https://www.nuoyunr.com',
// baseUrl: 'http://124.222.105.7:48080',
// baseUrl: 'http://192.168.1.4:48080',
baseUrl: "http://localhost:48080",
// baseUrl: "http://localhost:48080",
baseUrl: "http://rzqhb7.natappfree.cc",
imagesUrl: 'http://shequ.0315e.com/static/images/pages/',
baseImageUrl: 'https://www.nuoyunr.com/minio/',
shareUrl: 'https://www.lighting-it.cn/share?inviteId=',

View File

@ -121,9 +121,15 @@ export default {
cusFromValueList:[''],
//
cusFromIndex:0,
twId: null,
}
},
onLoad(){
onLoad(data){
if (data && data.twId){
this.twId = data.twId
}else {
this.twId = null
}
if(!getToken()){
uni.reLaunch({
url: '/pages/login/login'
@ -372,6 +378,9 @@ export default {
userId: this.userInfo.id,
soType: "01"
}
if (this.twId){
paramsObj.twId = this.twId
}
request({
url: '/admin-api/repair/so/page',
method: 'get',

View File

@ -50,6 +50,7 @@
<text class="label"></text>
<text class="repairNum"></text>
<view class="submit" @click="toPart">采购</view>
<view class="submit" @click="toInWares">入库单</view>
<view class="submit" @click="submitBefore">{{ isReceive ? '通知领料' : '通知退料' }}</view>
</view>
@ -122,6 +123,11 @@ export default {
computed: {},
methods: {
toInWares(){
uni.navigateTo({
url: '/pages-order/orderList/orderList?twId=' + this.twId
})
},
async submitBefore(){
if (!this.selectRows || this.selectRows.length === 0){
uni.showToast({

View File

@ -11,7 +11,7 @@
<view class="formItem" v-if="isInput">
<text class="formLabel">关键字</text>
<input type="text" style="text-align: right" v-model="query" placeholder="名称、规格、编码"/>
<view @click="searchQuery">查询</view>
<view @click="searchQuery" style="width: 3rem">查询</view>
</view>
<view class="formItem" v-if="!isInput">
<text class="formLabel">备注</text>
@ -35,8 +35,8 @@
</view>
</uni-card>
<uni-collapse ref="collapse">
<uni-collapse-item v-for="[key, value] in partList" :title="key + `(${value.length})`">
<uni-card v-for="(item, index) in value" :key="index">
<uni-collapse-item v-for="(key, index) in keys" :key="index" :title="key + `(${values.get(key).length})`">
<uni-card v-for="(item, index) in values.get(key)" :key="index">
<template>
<view class="card-header">
<radio v-if="isInput" :checked="item.isSelected" @click="chooseItem(item)"/>
@ -45,16 +45,19 @@
</template>
<view class="formItem">
<view class="formLabel">进价</view>
<input type="number" style="text-align: right" v-model="item.wares.purPrice" placeholder="请输入单价"/>
<input type="number" style="text-align: right" v-model="item.wares.purPrice"
placeholder="请输入单价"/>
</view>
<view class="formItem">
<view class="formLabel">售价</view>
<input type="number" style="text-align: right" v-model="item.wares.price" placeholder="请输入单价"/>
<input type="number" style="text-align: right" v-model="item.wares.price"
placeholder="请输入单价"/>
</view>
<view class="formItem">
<view class="formLabel">分类</view>
<view>
<picker @change="bindPickerChange($event, item)" :range="options" range-key="label">
<picker @change="bindPickerChange($event, item)" :range="options"
range-key="label">
<view class="picker">
{{ getServerName(item.wares.type) }}
</view>
@ -63,7 +66,8 @@
</view>
<view class="formItem">
<view class="formLabel">计量单价</view>
<picker @change="bindUnitChange($event, item)" :range="unitList" range-key="label">
<picker @change="bindUnitChange($event, item)" :range="unitList"
range-key="label">
<view class="picker">
{{ getUnitName(item.wares.unit) }}
</view>
@ -71,30 +75,23 @@
</view>
<view class="formItem" v-if="!isInput">
<view class="formLabel">数量</view>
<input type="number" style="text-align: right" v-model="item.waresCount" placeholder="请输入数量"/>
<input type="number" style="text-align: right" v-model="item.waresCount"
placeholder="请输入数量"/>
</view>
<view class="formItem" v-if="isInput">
<view class="formLabel">数量</view>
<input type="number" style="text-align: right" v-model="item.inCount" placeholder="请输入数量"/>
<input type="number" style="text-align: right" v-model="item.inCount"
placeholder="请输入数量"/>
</view>
<view class="formItem">
<view class="formLabel">仓库</view>
<uni-data-picker placeholder="请选择仓库" popup-title="请选择仓库" :localdata="waresTree" v-model="item.wares.warehouse">
<uni-data-picker placeholder="请选择仓库" popup-title="请选择仓库"
:localdata="waresTree" v-model="item.wares.warehouse">
</uni-data-picker>
</view>
</uni-card>
</uni-collapse-item>
</uni-collapse>
<!-- <uni-card v-for="(item, index) in partList" :key="index" :title="item.name" :extra="'上次价格:'+item.purPrice">-->
<!-- <view class="formItem">-->
<!-- <view class="formLabel">单价</view>-->
<!-- <input type="number" style="text-align: right" v-model="item.newPrice" placeholder="请输入单价"/>-->
<!-- </view>-->
<!-- <view class="formItem">-->
<!-- <view class="formLabel">数量</view>-->
<!-- <input type="number" style="text-align: right" v-model="item.count" placeholder="请输入数量"/>-->
<!-- </view>-->
<!-- </uni-card>-->
</view>
</view>
<view class="footer">
@ -151,6 +148,8 @@ export default {
subLoading: false,
waresTree: [],
chooseWares: null,
keys: [],
values: null
};
},
onLoad(data) {
@ -166,6 +165,7 @@ export default {
if (getJSONData("applyWaresForm")) {
this.formData = getJSONData("applyWaresForm")
this.wares = this.formData.items
this.twId = this.formData.id
this.init()
}
}
@ -181,29 +181,29 @@ export default {
})
},
chooseItem(item) {
const parentIndex = this.partList.map(([key, value]) => value).reduce((acc, value) => acc.concat(value)).findIndex(i => i.id === item.id)
const index = this.selectRows.findIndex(i => i.id === item.id)
const index = this.selectRows.findIndex(i => i.id === item.id);
if (index === -1) {
this.$set(item, 'isSelected', true)
this.selectRows.push(item)
item.isSelected = true;
this.selectRows.push(item);
} else {
this.$set(item, 'isSelected', false)
this.selectRows.splice(index, 1)
item.isSelected = false;
this.selectRows.splice(index, 1);
}
if (parentIndex !== -1){
const partListFlat = this.partList
.map(([key, value]) => value)
.reduce((acc, value) => acc.concat(value), []);
this.$set(partListFlat, parentIndex, { ...partListFlat[parentIndex], isSelected: item.isSelected });
const updatedPartList = this.partList.map(([key, value]) => {
// Map
const partListFlat = Array.from(this.values.values()).flat();
// Map
const updatedValues = new Map();
for (const [key, value] of this.values) {
const newValue = value.map(v => {
const foundItem = partListFlat.find(f => f.id === v.id);
return foundItem ? { ...v, ...foundItem } : v;
});
return [key, newValue];
});
this.$set(this, 'partList', updatedPartList);
updatedValues.set(key, newValue);
}
this.values = updatedValues;
},
searchQuery() {
this.getSoiId()
@ -324,6 +324,8 @@ export default {
i.totalPrice = i.waresCount * i.wares.purPrice
})
})
this.keys = this.partList.map(([key, value]) => key)
this.values = new Map(this.partList)
})
},
/**
@ -359,7 +361,7 @@ export default {
*/
submit() {
const userInfo = getUserInfo()
const values = this.partList.map(([key, value]) => value).reduce((acc, value) => acc.concat(value))
const values = Array.from(this.values.values()).flat();
const data = {
soType: '01',
purchaseType: '01',
@ -387,6 +389,9 @@ export default {
}
})]
data.waresList = [...values.map(item => item.wares)]
if (this.twId) {
data.twId = this.twId
}
request({
url: '/admin-api/repair/so/create',
method: 'post',
@ -435,6 +440,8 @@ export default {
})
})
}
this.keys = this.partList.map(([key, value]) => key)
this.values = new Map(this.partList)
})
},
/**
@ -447,7 +454,7 @@ export default {
id: this.soId,
soNo: createUniqueCodeByHead("RK")
}
const values = this.partList.map(([key, value]) => value).reduce((acc, item) => acc.concat(item))
const values = Array.from(this.values.values()).flat();
if (this.selectRows && this.selectRows.length > 0) {
const ids = this.selectRows.map(item => item.id)
const newSelect = values.filter(item => ids.includes(item.id))