|
|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
|
<view class="app-content">
|
|
|
- <form @submit="commitForm">
|
|
|
+ <form @submit="confirmFn">
|
|
|
<view class="module-com input-line-wrap">
|
|
|
|
|
|
<tui-list-cell class="line-cell" :hover="false">
|
|
|
@@ -25,7 +25,10 @@
|
|
|
|
|
|
<tui-list-cell class="line-cell" :hover="false">
|
|
|
<view class="tui-title required">欠款日期</view>
|
|
|
- <input v-model="form.date" placeholder-class="phcolor" class="tui-input" name="date" placeholder="欠款日期" maxlength="50" type="text" />
|
|
|
+
|
|
|
+ <view class="uni-input" v-if="form.date==''" style="color:#CCCCCC;width:500upx;" @click="changeDate">请选择日期</view>
|
|
|
+ <view class="uni-input" @click="changeDate" style="width:500upx;">{{form.date}}</view>
|
|
|
+
|
|
|
</tui-list-cell>
|
|
|
|
|
|
<tui-list-cell class="line-cell" :hover="false">
|
|
|
@@ -50,7 +53,7 @@
|
|
|
<view class="module-com input-line-wrap summary-wrap">
|
|
|
<view class="module-tit">其他说明</view>
|
|
|
<view class="module-det" style="padding-bottom: 20upx">
|
|
|
- <textarea v-model="form.briefContent" class="goods-summary" placeholder-class="phcolor" placeholder="补充说明" />
|
|
|
+ <textarea v-model="form.intro" class="goods-summary" placeholder-class="phcolor" placeholder="补充说明" />
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
|
@@ -60,6 +63,9 @@
|
|
|
</view>
|
|
|
|
|
|
</form>
|
|
|
+
|
|
|
+ <mx-date-picker :show="showPicker" format="yyyy-mm-dd" type="date" :value="defaultPickerDate" :show-tips="true" @confirm="confirmPicker" @cancel="showPicker = false" />
|
|
|
+
|
|
|
</view>
|
|
|
</template>
|
|
|
<script>
|
|
|
@@ -67,14 +73,17 @@ import { mapGetters } from "vuex";
|
|
|
import TuiListCell from "@/components/plugin/list-cell";
|
|
|
import AppUploader from "@/components/app-uploader";
|
|
|
const form = require("@/utils/formValidation.js");
|
|
|
-import { addGoodsData } from "@/api/goods"
|
|
|
+import { addEvent } from "@/api/ll"
|
|
|
import htzImageUpload from '@/components/htz-image-upload/htz-image-upload.vue'
|
|
|
+import MxDatePicker from '@/components/mx-datepicker/mx-datepicker.vue';
|
|
|
export default {
|
|
|
name: "add",
|
|
|
- components: { TuiListCell, AppUploader,htzImageUpload },
|
|
|
+ components: { TuiListCell, AppUploader,htzImageUpload,MxDatePicker },
|
|
|
mixins: [],
|
|
|
data() {
|
|
|
return {
|
|
|
+ defaultPickerDate:'',
|
|
|
+ showPicker: false,
|
|
|
headers:{token:''},
|
|
|
form: {
|
|
|
name: "",
|
|
|
@@ -82,7 +91,9 @@ export default {
|
|
|
mobile:"",
|
|
|
amount: "",
|
|
|
date:"",
|
|
|
- no:""
|
|
|
+ no:"",
|
|
|
+ prove: [],
|
|
|
+ intro:''
|
|
|
},
|
|
|
currentImgData:[]
|
|
|
};
|
|
|
@@ -92,45 +103,69 @@ export default {
|
|
|
this.headers.token = token
|
|
|
},
|
|
|
methods: {
|
|
|
+ changeDate(){
|
|
|
+ this.showPicker = true
|
|
|
+ },
|
|
|
+ confirmPicker(e) {
|
|
|
+ this.form.date = e.value
|
|
|
+ this.showPicker = false
|
|
|
+ },
|
|
|
goBack(){
|
|
|
uni.navigateBack({delta:1})
|
|
|
},
|
|
|
imgDeleteFn(res){
|
|
|
const index = res.index
|
|
|
- this.form.shopImg.splice(index,1)
|
|
|
+ this.form.prove.splice(index,1)
|
|
|
},
|
|
|
imgUploadSuccess(res) {
|
|
|
var _res = JSON.parse(res.data)
|
|
|
if(_res.code == 1){
|
|
|
this.currentImgData.push(_res.data.smallUrl)
|
|
|
- this.form.shopImg.push(_res.data.shortUrl)
|
|
|
+ this.form.prove.push(_res.data.shortUrl)
|
|
|
}
|
|
|
},
|
|
|
init() {
|
|
|
|
|
|
},
|
|
|
- confirmFn() {
|
|
|
+ confirmFn(){
|
|
|
let that = this
|
|
|
- if (this.$util.isEmpty(this.form.shopImg)) {
|
|
|
- this.$msg("请上传图片");
|
|
|
+ if (this.$util.isEmpty(this.form.name)){
|
|
|
+ this.$msg('请填写店名或姓名')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (this.$util.isEmpty(this.form.mobile) && this.$util.isEmpty(this.form.wx) && this.$util.isEmpty(this.form.no)){
|
|
|
+ this.$msg('手机号、微信号或身份证号必填一项')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if(!this.$util.isEmpty(this.form.mobile)){
|
|
|
+ if(this.$util.checkMobile(this.form.mobile) == false){
|
|
|
+ this.$msg('请填写正确手机号')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (this.$util.isEmpty(this.form.date)){
|
|
|
+ this.$msg('请填写日期')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (this.$util.isEmpty(this.form.amount) || Number(this.form.amount)<=0){
|
|
|
+ this.$msg('请填写金额')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (this.$util.isEmpty(this.form.prove)) {
|
|
|
+ this.$msg("请上传证据,最少一张");
|
|
|
return false;
|
|
|
}
|
|
|
- this.form.cover = this.form.shopImg[0]
|
|
|
-
|
|
|
that.$util.confirmModal({content:'确认添加?提交后不可修改'},() => {
|
|
|
uni.showLoading({mask:true})
|
|
|
- let form = JSON.parse(JSON.stringify(this.form));
|
|
|
- addGoodsData({...form,itemList:JSON.stringify(product) }).then(res => {
|
|
|
+ console.log(this.form)
|
|
|
+ addEvent(this.form).then(res => {
|
|
|
uni.hideLoading()
|
|
|
this.$msg("添加成功")
|
|
|
setTimeout(function(){
|
|
|
- uni.navigateBack({})
|
|
|
- },1500)
|
|
|
+ uni.navigateBack()
|
|
|
+ },1200)
|
|
|
})
|
|
|
})
|
|
|
- },
|
|
|
- commitForm(e) {
|
|
|
- this.confirmFn()
|
|
|
}
|
|
|
}
|
|
|
};
|