|
@@ -5,27 +5,32 @@
|
|
|
|
|
|
|
|
<tui-list-cell class="line-cell" :hover="false">
|
|
<tui-list-cell class="line-cell" :hover="false">
|
|
|
<view class="tui-title required">店名</view>
|
|
<view class="tui-title required">店名</view>
|
|
|
- <input v-model="form.name" placeholder-class="phcolor" class="tui-input" name="name" placeholder="请填写店名、姓名或公司名" maxlength="50" type="text" />
|
|
|
|
|
|
|
+ <input v-model="form.name" placeholder-class="phcolor" class="tui-input" name="name" placeholder="店名、姓名或公司名" maxlength="50" type="text" />
|
|
|
</tui-list-cell>
|
|
</tui-list-cell>
|
|
|
|
|
|
|
|
<tui-list-cell class="line-cell" :hover="false">
|
|
<tui-list-cell class="line-cell" :hover="false">
|
|
|
- <view class="tui-title required">微信号</view>
|
|
|
|
|
- <input v-model="form.name" placeholder-class="phcolor" class="tui-input" name="name" placeholder="请填写对方微信号" maxlength="50" type="text" />
|
|
|
|
|
|
|
+ <view class="tui-title">手机号</view>
|
|
|
|
|
+ <input v-model="form.mobile" placeholder-class="phcolor" class="tui-input" name="mobile" placeholder="对方手机号" maxlength="50" type="text" />
|
|
|
</tui-list-cell>
|
|
</tui-list-cell>
|
|
|
|
|
|
|
|
<tui-list-cell class="line-cell" :hover="false">
|
|
<tui-list-cell class="line-cell" :hover="false">
|
|
|
- <view class="tui-title required">手机号</view>
|
|
|
|
|
- <input v-model="form.name" placeholder-class="phcolor" class="tui-input" name="name" placeholder="请填写对方手机号" maxlength="50" type="text" />
|
|
|
|
|
|
|
+ <view class="tui-title">微信号</view>
|
|
|
|
|
+ <input v-model="form.wx" placeholder-class="phcolor" class="tui-input" name="wx" placeholder="对方微信号" maxlength="50" type="text" />
|
|
|
</tui-list-cell>
|
|
</tui-list-cell>
|
|
|
|
|
|
|
|
<tui-list-cell class="line-cell" :hover="false">
|
|
<tui-list-cell class="line-cell" :hover="false">
|
|
|
- <view class="tui-title required">账单日期</view>
|
|
|
|
|
- <input v-model="form.name" placeholder-class="phcolor" class="tui-input" name="name" placeholder="请选账单交易日期" maxlength="50" type="text" />
|
|
|
|
|
|
|
+ <view class="tui-title">身份证号</view>
|
|
|
|
|
+ <input v-model="form.no" placeholder-class="phcolor" class="tui-input" name="no" placeholder="对方身份证号或营业执照号" maxlength="50" type="text" />
|
|
|
</tui-list-cell>
|
|
</tui-list-cell>
|
|
|
|
|
|
|
|
<tui-list-cell class="line-cell" :hover="false">
|
|
<tui-list-cell class="line-cell" :hover="false">
|
|
|
- <view class="tui-title required">账单金额</view>
|
|
|
|
|
- <input v-model="form.price" placeholder-class="phcolor" class="tui-input" name="price" placeholder="请填写对方赖账金额" maxlength="50" type="digit" />
|
|
|
|
|
|
|
+ <view class="tui-title required">欠款日期</view>
|
|
|
|
|
+ <input v-model="form.date" placeholder-class="phcolor" class="tui-input" name="date" placeholder="选账单交易日期" maxlength="50" type="text" />
|
|
|
|
|
+ </tui-list-cell>
|
|
|
|
|
+
|
|
|
|
|
+ <tui-list-cell class="line-cell" :hover="false">
|
|
|
|
|
+ <view class="tui-title required">欠款金额</view>
|
|
|
|
|
+ <input v-model="form.amount" placeholder-class="phcolor" class="tui-input" name="amount" placeholder="对方欠款金额" maxlength="50" type="digit" />
|
|
|
</tui-list-cell>
|
|
</tui-list-cell>
|
|
|
|
|
|
|
|
</view>
|
|
</view>
|
|
@@ -62,38 +67,23 @@ import { mapGetters } from "vuex";
|
|
|
import TuiListCell from "@/components/plugin/list-cell";
|
|
import TuiListCell from "@/components/plugin/list-cell";
|
|
|
import AppUploader from "@/components/app-uploader";
|
|
import AppUploader from "@/components/app-uploader";
|
|
|
const form = require("@/utils/formValidation.js");
|
|
const form = require("@/utils/formValidation.js");
|
|
|
-import { getClass } from "@/api/category";
|
|
|
|
|
import { addGoodsData } from "@/api/goods"
|
|
import { addGoodsData } from "@/api/goods"
|
|
|
import htzImageUpload from '@/components/htz-image-upload/htz-image-upload.vue'
|
|
import htzImageUpload from '@/components/htz-image-upload/htz-image-upload.vue'
|
|
|
-import productMins from "@/mixins/product";
|
|
|
|
|
-import {currentShop} from "@/api/shop"
|
|
|
|
|
export default {
|
|
export default {
|
|
|
name: "add",
|
|
name: "add",
|
|
|
components: { TuiListCell, AppUploader,htzImageUpload },
|
|
components: { TuiListCell, AppUploader,htzImageUpload },
|
|
|
- mixins: [productMins],
|
|
|
|
|
|
|
+ mixins: [],
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
headers:{token:''},
|
|
headers:{token:''},
|
|
|
- status: 1,
|
|
|
|
|
- selectJobType: "addGoodsSelectItem",
|
|
|
|
|
form: {
|
|
form: {
|
|
|
name: "",
|
|
name: "",
|
|
|
- price: "",
|
|
|
|
|
- catIds: [],
|
|
|
|
|
- autoRise: "1",
|
|
|
|
|
- needSend: "0",
|
|
|
|
|
- freightType: "0",
|
|
|
|
|
- shopImg: [],
|
|
|
|
|
- briefContent: "",
|
|
|
|
|
- status:1,
|
|
|
|
|
- cover:'',
|
|
|
|
|
- setItemNum:0,
|
|
|
|
|
- kindId:0,
|
|
|
|
|
- kindName:'',
|
|
|
|
|
- inTurn:0,
|
|
|
|
|
- stock:0
|
|
|
|
|
|
|
+ wx:"",
|
|
|
|
|
+ mobile:"",
|
|
|
|
|
+ amount: "",
|
|
|
|
|
+ date:"",
|
|
|
|
|
+ no:""
|
|
|
},
|
|
},
|
|
|
- categoryData:[],
|
|
|
|
|
currentImgData:[]
|
|
currentImgData:[]
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
@@ -101,15 +91,7 @@ export default {
|
|
|
const token = uni.getStorageSync('token')
|
|
const token = uni.getStorageSync('token')
|
|
|
this.headers.token = token
|
|
this.headers.token = token
|
|
|
},
|
|
},
|
|
|
- watch:{
|
|
|
|
|
- },
|
|
|
|
|
methods: {
|
|
methods: {
|
|
|
- changeKind(){
|
|
|
|
|
- this.pageTo({url:'/admin/goods/selectKind?style=2&flower=1'})
|
|
|
|
|
- },
|
|
|
|
|
- selectItem(){
|
|
|
|
|
- this.pageTo({url:'/admin/goods/selectItem'})
|
|
|
|
|
- },
|
|
|
|
|
goBack(){
|
|
goBack(){
|
|
|
uni.navigateBack({delta:1})
|
|
uni.navigateBack({delta:1})
|
|
|
},
|
|
},
|
|
@@ -125,102 +107,30 @@ export default {
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
init() {
|
|
init() {
|
|
|
- getClass({flower:1}).then(res => {
|
|
|
|
|
- if(res.code && res.code == 1){
|
|
|
|
|
- this.categoryData = res.data
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
|
|
+
|
|
|
},
|
|
},
|
|
|
confirmFn() {
|
|
confirmFn() {
|
|
|
let that = this
|
|
let that = this
|
|
|
- if (this.$util.isEmpty(this.form.catIds)) {
|
|
|
|
|
- this.$msg("请选择分类");
|
|
|
|
|
- return false;
|
|
|
|
|
- }
|
|
|
|
|
if (this.$util.isEmpty(this.form.shopImg)) {
|
|
if (this.$util.isEmpty(this.form.shopImg)) {
|
|
|
this.$msg("请上传图片");
|
|
this.$msg("请上传图片");
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- if(!this.form.kindId || Number(this.form.kindId) == 0){
|
|
|
|
|
- this.$msg('请选择品种')
|
|
|
|
|
- return false
|
|
|
|
|
- }
|
|
|
|
|
- if (this.$util.isEmpty(this.form.kindName)) {
|
|
|
|
|
- this.$msg("请选择品种哦")
|
|
|
|
|
- return false
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
this.form.cover = this.form.shopImg[0]
|
|
this.form.cover = this.form.shopImg[0]
|
|
|
- const product = this.selectList.map(ele => {
|
|
|
|
|
- let unitName = ele.bigUnit
|
|
|
|
|
- let unitType = 0
|
|
|
|
|
- let num = ele.bigCount
|
|
|
|
|
- let count = ele.bigCount
|
|
|
|
|
- if(Number(ele.smallCount)>0){
|
|
|
|
|
- unitType = 1
|
|
|
|
|
- unitName = ele.smallUnit
|
|
|
|
|
- num=Number(ele.smallCount)
|
|
|
|
|
- count = (ele.smallCount/ele.ratio).toFixed(2)
|
|
|
|
|
- }
|
|
|
|
|
- return { id: ele.id, unitType:unitType,ptItemId:ele.itemId,bigName:ele.bigUnit,smallName:ele.smallUnit,unitName:unitName,cover:ele.shortCover,
|
|
|
|
|
- name:ele.name,ratio:ele.ratio,num:num,count:count}
|
|
|
|
|
- })
|
|
|
|
|
- that.$util.confirmModal({content:'确认添加?'},() => {
|
|
|
|
|
|
|
+
|
|
|
|
|
+ that.$util.confirmModal({content:'确认添加?提交后不可修改'},() => {
|
|
|
uni.showLoading({mask:true})
|
|
uni.showLoading({mask:true})
|
|
|
let form = JSON.parse(JSON.stringify(this.form));
|
|
let form = JSON.parse(JSON.stringify(this.form));
|
|
|
- addGoodsData({ status: this.status, ...form,itemList:JSON.stringify(product) }).then(res => {
|
|
|
|
|
|
|
+ addGoodsData({...form,itemList:JSON.stringify(product) }).then(res => {
|
|
|
uni.hideLoading()
|
|
uni.hideLoading()
|
|
|
this.$msg("添加成功")
|
|
this.$msg("添加成功")
|
|
|
- this.removeFromSaveDirect()
|
|
|
|
|
setTimeout(function(){
|
|
setTimeout(function(){
|
|
|
uni.navigateBack({})
|
|
uni.navigateBack({})
|
|
|
},1500)
|
|
},1500)
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
- selCategoryFn(item) {
|
|
|
|
|
- let index = this.form.catIds.findIndex(e => e == item.id);
|
|
|
|
|
- if (index == -1) {
|
|
|
|
|
- this.form.catIds.push(item.id);
|
|
|
|
|
- } else {
|
|
|
|
|
- this.form.catIds.splice(index, 1);
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- autoRiseChange(e) {
|
|
|
|
|
- this.form.autoRise = e == "0" ? "1" : "0";
|
|
|
|
|
- },
|
|
|
|
|
- needSendChange(e) {
|
|
|
|
|
- this.form.needSend = e == "0" ? "1" : "0";
|
|
|
|
|
- },
|
|
|
|
|
- freightChange(e) {
|
|
|
|
|
- this.form.freightType = e.detail.value;
|
|
|
|
|
- },
|
|
|
|
|
- setItemNumChange(e){
|
|
|
|
|
- this.form.setItemNum = e.detail.value;
|
|
|
|
|
- },
|
|
|
|
|
commitForm(e) {
|
|
commitForm(e) {
|
|
|
- let rules = [
|
|
|
|
|
- {
|
|
|
|
|
- name: "name",
|
|
|
|
|
- rule: ["required"],
|
|
|
|
|
- msg: ["请输入名称"]
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- name: "price",
|
|
|
|
|
- rule: ["required"],
|
|
|
|
|
- msg: ["请输入价格"]
|
|
|
|
|
- }
|
|
|
|
|
- ];
|
|
|
|
|
- let formData = e.detail.value;
|
|
|
|
|
- let checkRes = form.validation(formData, rules);
|
|
|
|
|
- if (!checkRes) {
|
|
|
|
|
- setTimeout(() => {
|
|
|
|
|
- this.confirmFn();
|
|
|
|
|
- });
|
|
|
|
|
- } else {
|
|
|
|
|
- this.$msg(checkRes);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ this.confirmFn()
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|