|
@@ -14,7 +14,7 @@
|
|
|
>
|
|
|
<u-input readonly v-model="orderForm.materialName" border="none"
|
|
|
placeholder="请选择品种"/>
|
|
|
- <view slot="right" @click.stop="addMater">
|
|
|
+ <view slot="right" @click.stop="addOpen(true)">
|
|
|
<u-button
|
|
|
type="primary"
|
|
|
size="mini"
|
|
@@ -26,7 +26,7 @@
|
|
|
<u-form-item label="客户" borderBottom prop="companyId" @click="showPopup('popupCompany')">
|
|
|
<u-input readonly v-model="orderForm.companyName" border="none"
|
|
|
placeholder="请选择客户"/>
|
|
|
- <view slot="right" @click.stop="addCompany">
|
|
|
+ <view slot="right" @click.stop="addOpen(false)">
|
|
|
<u-button
|
|
|
|
|
|
type="primary"
|
|
@@ -59,6 +59,11 @@
|
|
|
<CarKeyboard :show.sync="carKeyboardShow" :isProvince="false" :vehicleNo="orderForm.vehicle"
|
|
|
@confirm="carConfirm" vehicleType="car">
|
|
|
</CarKeyboard>
|
|
|
+ <u-modal @confirm="addConfirm" @cancel="addCancel" :show="addShow" :showCancelButton="true" :closeOnClickOverlay="true" :title="addTitle">
|
|
|
+ <view class="add-input" slot="default">
|
|
|
+ <u-input type="text" v-model="keyName" placeholder="请输入名称"/>
|
|
|
+ </view>
|
|
|
+ </u-modal>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
@@ -84,6 +89,9 @@
|
|
|
return {
|
|
|
carKeyboardShow: false,
|
|
|
start: dayjs().format('YYYY-MM-DD'),
|
|
|
+ addShow: false,
|
|
|
+ addTitle:"",
|
|
|
+ keyName:"",
|
|
|
orderForm: {
|
|
|
roadId: '',
|
|
|
roadName: '',
|
|
@@ -112,69 +120,68 @@
|
|
|
showPopup(refs) {
|
|
|
this.$refs[refs].showPicker = true
|
|
|
},
|
|
|
- //新增物料
|
|
|
- addMater(e){
|
|
|
- console.log(e);
|
|
|
-
|
|
|
- let that = this
|
|
|
- uni.showModal({
|
|
|
- title: '新增品种',
|
|
|
- editable:true,
|
|
|
- showCancel: true,
|
|
|
- placeholderText:'请输入品种名称',
|
|
|
- success: ({ confirm, cancel , content}) => {
|
|
|
- if(confirm){
|
|
|
- uni.showLoading({
|
|
|
- title: '保存中',
|
|
|
- mask:true,
|
|
|
- });
|
|
|
- saveMaterial({name:content}).then(res=>{
|
|
|
- if(res.statusCode == '200'){
|
|
|
- uni.showToast({
|
|
|
- title: '保存成功',
|
|
|
- icon: 'none',
|
|
|
- mask: true
|
|
|
- })
|
|
|
- that.getMater()
|
|
|
- }
|
|
|
- uni.hideLoading();
|
|
|
- }).finally(()=>{
|
|
|
- uni.hideLoading();
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
+ //新增
|
|
|
+ addOpen(boo){
|
|
|
+ this.addShow = true
|
|
|
+ this.addType = boo
|
|
|
+ if(boo){
|
|
|
+ this.addTitle = "新增品种"
|
|
|
+ }else{
|
|
|
+ this.addTitle = "新增客户"
|
|
|
+ }
|
|
|
},
|
|
|
- //新增客户
|
|
|
- addCompany(){
|
|
|
+ addCancel(){
|
|
|
+ this.addShow = false
|
|
|
+ this.keyName = ''
|
|
|
+ },
|
|
|
+ //新增
|
|
|
+ addConfirm(){
|
|
|
let that = this
|
|
|
- uni.showModal({
|
|
|
- title: '新增客户',
|
|
|
- editable:true,
|
|
|
- showCancel: true,
|
|
|
- placeholderText:'请输入客户名称',
|
|
|
- success: ({ confirm, cancel , content}) => {
|
|
|
- if(confirm){
|
|
|
- uni.showLoading({
|
|
|
- title: '保存中',
|
|
|
- mask:true,
|
|
|
- });
|
|
|
- saveCompany({name:content}).then(res=>{
|
|
|
- if(res.statusCode == '200'){
|
|
|
- uni.showToast({
|
|
|
- title: '保存成功',
|
|
|
- icon: 'none',
|
|
|
- mask: true
|
|
|
- })
|
|
|
- that.getCompany()
|
|
|
- }
|
|
|
- uni.hideLoading();
|
|
|
- }).finally(()=>{
|
|
|
- uni.hideLoading();
|
|
|
- });
|
|
|
+ if(!that.keyName){
|
|
|
+ uni.showToast({
|
|
|
+ title: '请输入名称',
|
|
|
+ icon: 'none',
|
|
|
+ mask: true
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ uni.showLoading({
|
|
|
+ title: '保存中',
|
|
|
+ mask:true,
|
|
|
+ });
|
|
|
+ if(this.addType){
|
|
|
+ saveMaterial({name:that.keyName}).then(res=>{
|
|
|
+ if(res.statusCode == '200'){
|
|
|
+ uni.showToast({
|
|
|
+ title: '保存成功',
|
|
|
+ icon: 'none',
|
|
|
+ mask: true
|
|
|
+ })
|
|
|
+ that.addShow = false
|
|
|
+ that.keyName = ''
|
|
|
+ that.getMater()
|
|
|
}
|
|
|
- }
|
|
|
- })
|
|
|
+ uni.hideLoading();
|
|
|
+ }).finally(()=>{
|
|
|
+ uni.hideLoading();
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ saveCompany({name:that.keyName}).then(res=>{
|
|
|
+ if(res.statusCode == '200'){
|
|
|
+ uni.showToast({
|
|
|
+ title: '保存成功',
|
|
|
+ icon: 'none',
|
|
|
+ mask: true
|
|
|
+ })
|
|
|
+ that.addShow = false
|
|
|
+ that.keyName = ''
|
|
|
+ that.getCompany()
|
|
|
+ }
|
|
|
+ uni.hideLoading();
|
|
|
+ }).finally(()=>{
|
|
|
+ uni.hideLoading();
|
|
|
+ });
|
|
|
+ }
|
|
|
},
|
|
|
//获取客户
|
|
|
getCompany(){
|
|
@@ -344,6 +351,9 @@
|
|
|
padding: 0 32rpx;
|
|
|
}
|
|
|
}
|
|
|
+ .add-input{
|
|
|
+ width: 100%;
|
|
|
+ }
|
|
|
|
|
|
// button {
|
|
|
// // background:linear-gradient(to right,#4680F9 0%,#00e2fa 80%,#00e2fa 100%);
|