|
|
@@ -5,9 +5,7 @@
|
|
|
<view class="item">
|
|
|
<text class="left">分类</text>
|
|
|
<view class="class-item-list">
|
|
|
- <view>花束</view>
|
|
|
- <view>花盒</view>
|
|
|
- <view>盆栽</view>
|
|
|
+ <view v-for="info in catList" :class="[form.catId===info.id?'selected':'']" @click="setCat(info)" :key="info.id">{{info.categoryName}}</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="item">
|
|
|
@@ -19,21 +17,27 @@
|
|
|
<view class="item">
|
|
|
<text class="left">图片</text>
|
|
|
<view>
|
|
|
-
|
|
|
- <htz-image-upload :max="1" :compress="true" v-model="currentImgData" :headers="headers"
|
|
|
- @uploadSuccess="imgUploadSuccess" @imgDelete="imgDeleteFn" :action="getLoginInfo.imgUploadApi">
|
|
|
- </htz-image-upload>
|
|
|
+
|
|
|
+ <htz-image-upload :max="1" :compress="true" v-model="currentImgData" :headers="headers"
|
|
|
+ @uploadSuccess="imgUploadSuccess" @imgDelete="imgDeleteFn" :action="getLoginInfo.imgUploadApi">
|
|
|
+ </htz-image-upload>
|
|
|
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="item">
|
|
|
<text class="left">打印</text>
|
|
|
- <switch :checked="print == 1 ? true : false" @change="changePrint" style="transform: scale(0.9,0.8)" />
|
|
|
+ <switch :checked="form.needPrint == 1 ? true : false" @change="changePrint" style="transform: scale(0.9,0.8)" />
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <view class="item">
|
|
|
+ <text class="left">直接完成</text>
|
|
|
+ <switch :checked="form.complete == 1 ? true : false" @change="changeComplete" style="transform: scale(0.9,0.8)" />
|
|
|
</view>
|
|
|
+
|
|
|
</view>
|
|
|
<view class="footer">
|
|
|
- <button @click="cancelFinish()">取消</button>
|
|
|
- <button @click="confirmFinish()">确认</button>
|
|
|
+ <button @click="cancelCreate()">取消</button>
|
|
|
+ <button @click="confirmCreate()">确认</button>
|
|
|
</view>
|
|
|
</view>
|
|
|
</template>
|
|
|
@@ -41,23 +45,31 @@
|
|
|
//图片上传插件来源:https://ext.dcloud.net.cn/plugin?id=2922 已改造,不能再升级 shish 20211228
|
|
|
import htzImageUpload from './htz-image-upload/htz-image-upload.vue'
|
|
|
import { mapGetters } from "vuex"
|
|
|
+import {getClass} from '@/api/category'
|
|
|
+import productMins from "@/mixins/product"
|
|
|
+import { createWorkFn } from '@/api/work'
|
|
|
export default {
|
|
|
name:'finishWork',
|
|
|
components:{
|
|
|
htzImageUpload
|
|
|
},
|
|
|
+ mixins: [productMins],
|
|
|
data(){
|
|
|
return {
|
|
|
- print:1,
|
|
|
flowerNumList:[{num:0,name:'无'},{num:6,name:6},{num:9,name:9},{num:11,name:11},{num:19,name:19},{num:33,name:33},{num:52,name:52},{num:66,name:66},{num:99,name:99}],
|
|
|
+ catList:[],
|
|
|
form:{
|
|
|
name:'',
|
|
|
catId:0,
|
|
|
flowerNum:0,
|
|
|
cover:'',
|
|
|
- print:0
|
|
|
+ needPrint:1,
|
|
|
+ complete:1
|
|
|
},
|
|
|
- headers:{token:''}
|
|
|
+ headers:{token:''},
|
|
|
+ currentImgData:[],
|
|
|
+ currentJobType:'make',
|
|
|
+ currentJobId:0,
|
|
|
}
|
|
|
},
|
|
|
computed:{
|
|
|
@@ -66,22 +78,83 @@ export default {
|
|
|
mounted(){
|
|
|
const token = uni.getStorageSync('token')
|
|
|
this.headers.token = token
|
|
|
+ getClass({flower:1}).then(res=>{
|
|
|
+ if(res.code == 1){
|
|
|
+ this.catList = res.data
|
|
|
+ if(!this.$util.isEmpty(this.catList)){
|
|
|
+ this.form.catId = this.catList[0].id
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
methods:{
|
|
|
+ imgUploadSuccess(res) {
|
|
|
+ var _res = JSON.parse(res.data)
|
|
|
+ if(_res.code == 1){
|
|
|
+ this.currentImgData.push(_res.data.smallUrl)
|
|
|
+ this.form.cover = _res.data.shortUrl
|
|
|
+ }
|
|
|
+ },
|
|
|
+ imgDeleteFn(res){
|
|
|
+ this.form.cover = ''
|
|
|
+ },
|
|
|
setNum(info){
|
|
|
this.form.flowerNum = info.num
|
|
|
},
|
|
|
- changePrint(){
|
|
|
-
|
|
|
+ setCat(info){
|
|
|
+ this.form.catId = info.id
|
|
|
},
|
|
|
- cancelFinish(){
|
|
|
- this.$emit('cancelFinish')
|
|
|
+ changePrint(e){
|
|
|
+ if(e.detail.value == true){
|
|
|
+ this.form.needPrint = 1
|
|
|
+ }else{
|
|
|
+ this.form.needPrint = 2
|
|
|
+ }
|
|
|
+ },
|
|
|
+ changeComplete(e){
|
|
|
+ if(e.detail.value == true){
|
|
|
+ this.form.complete = 1
|
|
|
+ }else{
|
|
|
+ this.form.complete = 0
|
|
|
+ }
|
|
|
},
|
|
|
- confirmFinish(){
|
|
|
- this.$emit('confirmFinish',this.form)
|
|
|
+ cancelCreate(){
|
|
|
+ this.$emit('cancelCreate')
|
|
|
+ },
|
|
|
+ confirmCreate(){
|
|
|
+ this.$util.hitRemind()
|
|
|
+ if(this.$util.isEmpty(this.form.name)){
|
|
|
+ this.$msg('请填写名称')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if(this.form.cover == ''){
|
|
|
+ this.$msg('请上传图片')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if(this.$util.isEmpty(this.selectList)){
|
|
|
+ this.$msg('请选择花材')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ let product = this.selectList.map(i=>({ productId:i.id, unitType: i.unitType, num: i.currentNum}))
|
|
|
+ uni.showLoading({mask:true})
|
|
|
+ createWorkFn({...this.form,product:JSON.stringify(product)}).then(res=>{
|
|
|
+ uni.hideLoading()
|
|
|
+ if(res.code == 1){
|
|
|
+ this.$msg(res.msg)
|
|
|
+ this.$emit('confirmCreate')
|
|
|
+ this.removeFromSaveDirect()
|
|
|
+
|
|
|
+ this.form.cover = ''
|
|
|
+ this.currentImgData = []
|
|
|
+ this.form.name=''
|
|
|
+ this.form.catId = this.catList[0].id
|
|
|
+ this.form.flowerNum = 0
|
|
|
+ this.form.needPrint = 1
|
|
|
+ this.form.complete = 1
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
- },
|
|
|
- watch:{
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
@@ -116,7 +189,7 @@ export default {
|
|
|
width:150upx;
|
|
|
flex-wrap:wrap;
|
|
|
display:flex;
|
|
|
- justify-content:space-between;
|
|
|
+ justify-content:center;
|
|
|
margin:5upx 0 5upx 0;
|
|
|
view{
|
|
|
width:30upx;
|
|
|
@@ -127,7 +200,12 @@ export default {
|
|
|
display: flex;
|
|
|
justify-content:center;
|
|
|
align-items:center;
|
|
|
- }
|
|
|
+ margin-left:3upx;
|
|
|
+ }
|
|
|
+ .selected{
|
|
|
+ background-color:#CCCCCC;
|
|
|
+ color:white;
|
|
|
+ }
|
|
|
}
|
|
|
.flower-num-list{
|
|
|
width:150upx;
|