shish 3 anni fa
parent
commit
9f60a795c6
2 ha cambiato i file con 45 aggiunte e 56 eliminazioni
  1. 5 0
      hdPad/src/api/kind/index.js
  2. 40 56
      hdPad/src/pages/home/components/createWork.vue

+ 5 - 0
hdPad/src/api/kind/index.js

@@ -0,0 +1,5 @@
+import https from '@/plugins/luch-request_0.0.7/request'
+
+export const getAllKind = data => {
+	return https.get('/kind/get-all-kind', data)
+}

+ 40 - 56
hdPad/src/pages/home/components/createWork.vue

@@ -2,31 +2,26 @@
     <view class="finish-area">
         <view class="cell-item">
           <view class="item">
-            <text class="left">支数</text>
-            <view class="flower-num-list">
-                <view v-for="info in flowerNumList" :class="[form.flowerNum===info.num?'selected':'']" @click="setNum(info)" :key="info.num">{{info.name}}</view>
+            <text class="left">种类</text>
+            <view class="class-item-list">
+                <view v-for="info in kindList" :class="[form.kindId===info.id?'selected':'']" @click="setKind(info)" :key="info.id">{{info.name}}</view>
             </view>
           </view>
           <view class="item">
-            <text class="left">分类</text>
-            <view class="class-item-list">
-                <view v-for="info in catList" :class="[form.catId===info.id?'selected':'']" @click="setCat(info)" :key="info.id">{{info.categoryName}}</view>
+            <text class="left">支数</text>
+            <view class="flower-num-list">
+                <view v-for="info in flowerNumList" :class="[form.flowerNum===info.num?'selected':'']" @click="setNum(info)" :key="info.num">{{info.name}}</view>
             </view>
           </view>
-          <view class="item"><text class="left">名称</text> <input v-model="form.name" style="height:40upx;" placeholder="请填写名称" @focus="form.name=''" placeholder-class="gray" /></view>
-          <view class="item"><text class="left">数量</text> <input v-model="form.num" style="height:40upx;" type="number" @focus="form.num=''" placeholder="请填写数量" placeholder-class="gray" /></view>
-
           <view class="item">
-            <text class="left">出标签</text> 
-            <switch :checked="form.print == 1 ? true : false" @change="printChange" style="transform: scale(0.8,0.8)" />{{form.print==1?'是':'否'}}
+            <text class="left">数量</text> 
+            <input v-model="form.num" style="height:40upx;border:1upx solid #CCCCCC;font-size:28upx;margin:8upx 0 8upx 0;width:40vw;text-align:center;" type="number" @focus="form.num=''" placeholder="请填写数量" placeholder-class="gray" />
           </view>
-
           <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>
+            <text class="left">打标签</text> 
+            <view style="margin:10upx 0 10upx 0;">
+                <text style="margin-right:10upx;font-size:16upx;position:absolute;right:100upx;">{{form.print==1?'是':'否'}}</text>
+                <switch :checked="form.print == 1 ? true : false" @change="printChange" style="transform: scale(1,1)" />
             </view>
           </view>
         </view>
@@ -42,10 +37,9 @@
     </view>
 </template>
 <script>
-//图片上传插件来源: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 { getAllKind } from '@/api/kind'
 import productMins from "@/mixins/product"
 import { createWorkFn } from '@/api/work'
 export default {
@@ -56,14 +50,12 @@ export default {
     mixins: [productMins],
     data(){
         return {
-            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:[],
+            flowerNumList:[{num:0,name:0},{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},{num:999,name:999}],
+            kindList:[],
             form:{
-                name:'花束',
-                catId:0,
+                kindId:0,
                 num:1,
                 flowerNum:0,
-                cover:'',
                 print:1
             },
             headers:{token:''},
@@ -79,11 +71,11 @@ export default {
     mounted(){
         const token = uni.getStorageSync('token')
         this.headers.token = token
-        getClass({flower:1}).then(res=>{
+        getAllKind({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
+                this.kindList = res.data.list ? res.data.list : []
+                if(!this.$util.isEmpty(this.kindList)){
+                    this.form.kindId = this.kindList[0].id
                 }
             }
         })
@@ -92,21 +84,11 @@ export default {
         printChange(e){
             this.form.print = e.detail.value ? 1 : 0;
         },
-        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
         },
-        setCat(info){
-            this.form.catId = info.id
+        setKind(info){
+            this.form.kindId = info.id
         },
         cancelCreate(){
             this.$emit('cancelCreate')
@@ -130,10 +112,8 @@ export default {
                     that.$emit('confirmCreate')
 					that.removeFromSaveDirect()
 
-                    that.form.cover = ''
                     that.currentImgData = []
-                    that.form.name=''
-                    that.form.catId = that.catList[0].id
+                    that.form.kindId = that.kindList[0].id
                     that.form.flowerNum = 0
 
 				}
@@ -145,8 +125,8 @@ export default {
 <style lang="scss" scoped>
 .finish-area {
     background-color: #ffffff;
-    width:40vw;
-    height:98vh;
+    width:60vw;
+    height:93vh;
     .cell-item{
         display:flex;
         font-size:11upx;
@@ -158,7 +138,7 @@ export default {
             align-items:center;
             display:flex;
             border-bottom:1upx solid #EEEEEE;
-            width:250upx;
+            width:48vw;
             min-height:30upx;
             padding:0 10upx 0 10upx;
             .left{
@@ -171,15 +151,17 @@ export default {
             }
         }
         .class-item-list{
-            width:150upx;
+            width:40vw;
+            height:auto;
             flex-wrap:wrap;
             display:flex;
             justify-content:center;
             margin:8upx 0 8upx 0;
             view{
-                width:30upx;
-                height:23upx;
-                font-size:8upx;
+                min-width:40upx;
+                height:40upx;
+                padding:0 4upx 0 4upx;
+                font-size:10upx;
                 border:1upx solid #DDDDDD;
                 border-radius:10upx;
                 display: flex;
@@ -194,16 +176,16 @@ export default {
             } 
         }
         .flower-num-list{
-            width:150upx;
-            height:60upx;
+            width:40vw;
+            height:auto;
             flex-wrap:wrap;
             display:flex;
             justify-content:space-between;
             margin:5upx 0 5upx 0;
             view{
-                width:26upx;
-                height:26upx;
-                font-size:8upx;
+                width:40upx;
+                height:40upx;
+                font-size:10upx;
                 margin-left:3upx;
                 border:1upx solid #DDDDDD;
                 border-radius:10upx;
@@ -220,10 +202,12 @@ export default {
     }
     .footer{
         display: flex;
-        margin-top:20upx;
+        margin-top:50upx;
         justify-content:center;
         button{
             width:80upx;
+            height:50upx;
+            line-height: 50upx;
             background-color: #fff;
             border:1upx solid #999999;
             color:#999999;