|
|
@@ -1,197 +1,175 @@
|
|
|
<template>
|
|
|
- <view class="app-content">
|
|
|
+ <div class="app-content">
|
|
|
<!-- 花材基本信息 -->
|
|
|
<form @submit="formSubmit">
|
|
|
- <view class="module-com input-line-wrap">
|
|
|
+ <div class="module-com input-line-wrap">
|
|
|
|
|
|
<tui-list-cell class="line-cell" :hover="false">
|
|
|
- <view class="tui-title">花材名称</view>
|
|
|
+ <div class="tui-title">名称</div>
|
|
|
<input v-model="form.name" placeholder-class="phcolor" class="tui-input" name="name" placeholder="请填写名称" @input="fillName($event)" maxlength="50" type="text" />
|
|
|
</tui-list-cell>
|
|
|
|
|
|
<tui-list-cell class="line-cell" :hover="false">
|
|
|
- <view class="tui-title">平台名称</view>
|
|
|
- <view style="color:#CCCCCC;width:450upx;height:45upx;" @click.stop="notModify">{{form.name}}</view>
|
|
|
+ <div class="tui-title">初始名称</div>
|
|
|
+ <view style="color:#CCCCCC;width:450upx;height:45upx;" @click.stop="notModify">
|
|
|
+ {{form.name}}
|
|
|
+ </view>
|
|
|
</tui-list-cell>
|
|
|
|
|
|
<tui-list-cell class="line-cell" :hover="false">
|
|
|
- <view class="tui-title">拼音缩写</view>
|
|
|
- <input
|
|
|
- v-model="form.py"
|
|
|
- placeholder-class="phcolor"
|
|
|
- class="tui-input"
|
|
|
- name="py"
|
|
|
- placeholder="请填写拼音首字母缩写"
|
|
|
- maxlength="50"
|
|
|
- type="text"
|
|
|
- />
|
|
|
+ <div class="tui-title">拼音缩写</div>
|
|
|
+ <input v-model="form.py" placeholder-class="phcolor" class="tui-input" name="py" placeholder="请填写拼音首字母缩写" maxlength="50" type="text" />
|
|
|
</tui-list-cell>
|
|
|
|
|
|
<tui-list-cell class="line-cell" :hover="false">
|
|
|
- <view class="tui-title">售价</view>
|
|
|
- <input
|
|
|
- v-model="form.price"
|
|
|
- placeholder-class="phcolor"
|
|
|
- class="tui-input"
|
|
|
- name="price"
|
|
|
- @focus="form.price=''"
|
|
|
- placeholder="请填写售价"
|
|
|
- maxlength="50"
|
|
|
- type="digit"
|
|
|
- />
|
|
|
+ <view class="tui-title">价格</view>
|
|
|
+ <input v-model="form.hjPrice" style="width:130upx;border:1upx solid #CCCCCC;text-align:center;height:50upx;" placeholder-class="phcolor"
|
|
|
+ class="tui-input" name="hjPrice" @focus="form.hjPrice=''" placeholder="大客价" type="digit" />
|
|
|
+ <input v-model="form.price" style="width:130upx;border:1upx solid #3385FF;text-align:center;height:50upx;color:#3385FF;margin-left:30upx;" placeholder-class="phcolor"
|
|
|
+ class="tui-input" name="price" @focus="form.price=''" placeholder="批发价" type="digit" @input="priceLinkage()" />
|
|
|
+ <input v-model="form.skPrice" style="width:130upx;border:1upx solid #CCCCCC;text-align:center;height:50upx;margin-left:30upx;" placeholder-class="phcolor"
|
|
|
+ class="tui-input" name="skPrice" @focus="form.skPrice=''" placeholder="零售价" type="digit" />
|
|
|
</tui-list-cell>
|
|
|
|
|
|
<tui-list-cell class="line-cell" :hover="false">
|
|
|
- <view class="tui-title">今日特价</view>
|
|
|
- <input
|
|
|
- v-model="form.discountPrice"
|
|
|
- placeholder-class="phcolor"
|
|
|
- class="tui-input"
|
|
|
- name="discountPrice"
|
|
|
- @focus="form.discountPrice=''"
|
|
|
- placeholder="不做特价填0"
|
|
|
- maxlength="50"
|
|
|
- type="digit"
|
|
|
- />
|
|
|
+ <view class="tui-title">特价</view>
|
|
|
+ <input v-model="form.hjDiscountPrice" style="width:130upx;border:1upx solid #CCCCCC;text-align:center;height:50upx;" placeholder-class="phcolor"
|
|
|
+ class="tui-input" name="hjDiscountPrice" @focus="form.hjDiscountPrice=''" placeholder="会员特价" type="digit" />
|
|
|
+ <input v-model="form.discountPrice" style="width:130upx;border:1upx solid #3385FF;margin-left:30upx;color:#3385FF;text-align:center;height:50upx;" placeholder-class="phcolor" @input="tjLinkage()"
|
|
|
+ class="tui-input" name="discountPrice" @focus="form.discountPrice=''" placeholder="无特价填0" maxlength="50" type="digit" />
|
|
|
+ <input v-model="form.skDiscountPrice" style="width:130upx;border:1upx solid #CCCCCC;text-align:center;height:50upx;margin-left:30upx;" placeholder-class="phcolor"
|
|
|
+ class="tui-input" name="skDiscountPrice" @focus="form.skDiscountPrice=''" placeholder="零售特价" type="digit" />
|
|
|
</tui-list-cell>
|
|
|
|
|
|
<tui-list-cell class="line-cell" :hover="false">
|
|
|
- <view class="tui-title">库存</view>
|
|
|
+ <view class="tui-title">成本</view>
|
|
|
+ <input v-model="form.cost" style="width:340upx;" placeholder-class="phcolor" @focus="form.cost=''" class="tui-input" name="cost" placeholder="请输入" type="digit"/>
|
|
|
+ </tui-list-cell>
|
|
|
+
|
|
|
+ <tui-list-cell class="line-cell" :hover="false">
|
|
|
+ <div class="tui-title">库存</div>
|
|
|
<input v-model="form.stock" style="width:340upx;" placeholder-class="phcolor" @focus="form.stock=''" @input="changeStock($event)" class="tui-input" name="stock" placeholder="请输入" type="digit"/>
|
|
|
- <button v-if="productData.id > 0" class="admin-button-com blue small" @click="goStockDetail(productData.id)">库存明细</button>
|
|
|
</tui-list-cell>
|
|
|
|
|
|
- <tui-list-cell class="line-cell" :arrow="true">
|
|
|
- <view class="tui-title">分类</view>
|
|
|
- <picker
|
|
|
- mode="selector"
|
|
|
- :value="form.classId"
|
|
|
- :range="itemClassData"
|
|
|
- range-key="name"
|
|
|
- @change="changeItemClassFn"
|
|
|
- class="tui-input"
|
|
|
- >
|
|
|
- <input v-model="form.classId" name="classId" type="text" hidden />
|
|
|
- <view v-if="form.classId" style="height:45upx;" >{{ itemClassSelectedData.name }}</view>
|
|
|
- <view class="tui-placeholder" style="height:45upx;" v-else>请选择</view>
|
|
|
- </picker>
|
|
|
+ <tui-list-cell class="line-cell" :hover="false" :arrow="true">
|
|
|
+ <div class="tui-title">分类</div>
|
|
|
+ <input v-model="form.classId" name="classId" type="text" hidden />
|
|
|
+ <view style="color:#CCCCCC;width:450upx;height:45upx;" @click.stop="changeClass()" v-if="form.classId == 0">
|
|
|
+ 请选择分类
|
|
|
+ </view>
|
|
|
+ <view @click.stop="changeClass()" style="width:450upx;height:45upx;" v-else>
|
|
|
+ {{form.className}}
|
|
|
+ </view>
|
|
|
+ </tui-list-cell>
|
|
|
+
|
|
|
+ <tui-list-cell class="line-cell" :hover="false">
|
|
|
+ <view class="tui-title">所属产品</view>
|
|
|
+ <view>
|
|
|
+ <block v-if="form.cpInfo && !$util.isEmpty(form.cpInfo)">
|
|
|
+ <button v-for="(cpItem, cpIndex) in form.cpInfo" class="admin-button-com blue mini-btn" style="margin-right:8upx;" @click.stop="delOneCp(cpItem,cpIndex)">{{cpItem.cpName}} ×</button>
|
|
|
+ </block>
|
|
|
+ <button class="admin-button-com default mini-btn" @click.stop="changeCp()">添加产品</button>
|
|
|
+ </view>
|
|
|
+ </tui-list-cell>
|
|
|
+
|
|
|
+ <tui-list-cell class="line-cell" :hover="false">
|
|
|
+ <div class="tui-title">比例类型</div>
|
|
|
+ <radio-group class="tui-input" @change="ratioTypeChange">
|
|
|
+ <label class="list" for="fixedLink">
|
|
|
+ <radio id="fixedLink" value="0" :checked="form.ratioType == 0" style="transform: scale(0.7,0.7);" />
|
|
|
+ <span class="checkbox-text" style="font-size:30upx;">固定</span>
|
|
|
+ </label>
|
|
|
+ <label class="list" for="dimLink">
|
|
|
+ <radio id="dimLink" value="1" :checked="form.ratioType == 1" style="transform: scale(0.7,0.7);" />
|
|
|
+ <span class="checkbox-text" style="font-size:30upx;">模糊(若干)</span>
|
|
|
+ </label>
|
|
|
+ </radio-group>
|
|
|
</tui-list-cell>
|
|
|
|
|
|
<tui-list-cell class="line-cell" :arrow="true">
|
|
|
- <view class="tui-title">大单位</view>
|
|
|
- <picker
|
|
|
- mode="selector"
|
|
|
- :value="form.bigUnitId"
|
|
|
- :range="unitData"
|
|
|
- range-key="name"
|
|
|
- @change="changeBigUnitFn"
|
|
|
- class="tui-input"
|
|
|
- >
|
|
|
+ <div class="tui-title">大单位</div>
|
|
|
+ <picker mode="selector" :value="form.bigUnitId" :range="unitData" range-key="name" @change="changeBigUnitFn" class="tui-input" >
|
|
|
<input v-model="form.bigUnitId" name="bigUnitId" type="text" hidden />
|
|
|
- <view v-if="form.bigUnitId">{{ bigUnitSelectedData.name }}</view>
|
|
|
- <view class="tui-placeholder" style="height:45upx;" v-else>请选择</view>
|
|
|
+ <div v-if="form.bigUnitId">{{ bigUnitSelectedData.name }}</div>
|
|
|
+ <div class="tui-placeholder" style="height:45upx;" v-else>请选择</div>
|
|
|
</picker>
|
|
|
</tui-list-cell>
|
|
|
|
|
|
<tui-list-cell class="line-cell" :arrow="true">
|
|
|
- <view class="tui-title">小单位</view>
|
|
|
- <picker
|
|
|
- mode="selector"
|
|
|
- :value="form.smallUnitId"
|
|
|
- :range="unitData"
|
|
|
- range-key="name"
|
|
|
- @change="changeSmallUnitFn"
|
|
|
- class="tui-input"
|
|
|
- >
|
|
|
+ <div class="tui-title">小单位</div>
|
|
|
+ <picker mode="selector" :value="form.smallUnitId" :range="unitData" range-key="name" @change="changeSmallUnitFn" class="tui-input" >
|
|
|
<input v-model="form.smallUnitId" name="smallUnitId" type="text" hidden />
|
|
|
- <view v-if="form.smallUnitId">{{ smallUnitSelectedData.name }}</view>
|
|
|
- <view class="tui-placeholder" v-else>请选择</view>
|
|
|
+ <div v-if="form.smallUnitId">{{ smallUnitSelectedData.name }}</div>
|
|
|
+ <div class="tui-placeholder" v-else>请选择</div>
|
|
|
</picker>
|
|
|
</tui-list-cell>
|
|
|
|
|
|
- <tui-list-cell class="line-cell" :hover="false">
|
|
|
- <view class="tui-title">加价</view>
|
|
|
- <input
|
|
|
- v-model="form.skAddPrice"
|
|
|
- placeholder-class="phcolor"
|
|
|
- class="tui-input"
|
|
|
- name="skAddPrice"
|
|
|
- @focus="form.skAddPrice=''"
|
|
|
- placeholder="请填写加价"
|
|
|
- maxlength="50"
|
|
|
- type="digit"
|
|
|
- />
|
|
|
- </tui-list-cell>
|
|
|
-
|
|
|
- <tui-list-cell class="line-cell" :hover="false">
|
|
|
- <view class="tui-title">单位比</view>
|
|
|
- <input
|
|
|
- v-model="form.ratio"
|
|
|
- placeholder-class="phcolor"
|
|
|
- class="tui-input"
|
|
|
- name="ratio"
|
|
|
- placeholder="如:1扎=20支,请填写20"
|
|
|
- maxlength="50"
|
|
|
- type="number"
|
|
|
- />
|
|
|
+ <tui-list-cell class="line-cell" :hover="false" v-if="form.ratioType == 0">
|
|
|
+ <div class="tui-title">单位比</div>
|
|
|
+ <input v-model="form.ratio" placeholder-class="phcolor" class="tui-input" name="ratio" placeholder="1扎=20支,请填写20" maxlength="50" type="number" />
|
|
|
</tui-list-cell>
|
|
|
|
|
|
<tui-list-cell class="line-cell" :hover="false">
|
|
|
- <view class="tui-title">每扎重量</view>
|
|
|
- <input
|
|
|
- v-model="form.weight"
|
|
|
- placeholder-class="phcolor"
|
|
|
- class="tui-input"
|
|
|
- name="weight"
|
|
|
- placeholder="单位:公斤"
|
|
|
- maxlength="50"
|
|
|
- type="digit"
|
|
|
- />
|
|
|
+ <div class="tui-title">每扎重量</div>
|
|
|
+ <input v-model="form.weight" placeholder-class="phcolor" class="tui-input" name="weight" placeholder="单位为公斤,参考红玫每扎1.2公斤" maxlength="50" type="digit" />
|
|
|
</tui-list-cell>
|
|
|
|
|
|
<tui-list-cell class="line-cell" :hover="false">
|
|
|
- <view class="tui-title">库存预警值</view>
|
|
|
- <input
|
|
|
- v-model="form.stockWarning"
|
|
|
- placeholder-class="phcolor"
|
|
|
- class="tui-input"
|
|
|
- name="stockWarning"
|
|
|
- placeholder="请填写"
|
|
|
- maxlength="50"
|
|
|
- type="number"
|
|
|
- />
|
|
|
+ <div class="tui-title">库存预警</div>
|
|
|
+ <input v-model="form.stockWarning" placeholder-class="phcolor" class="tui-input" name="stockWarning" placeholder="请填写" maxlength="50" type="number" />
|
|
|
</tui-list-cell>
|
|
|
|
|
|
<tui-list-cell class="line-cell" :hover="false">
|
|
|
- <view class="tui-title">上架状态</view>
|
|
|
- <view class="switch_bx">
|
|
|
- <switch :checked="form.status == 2 ? false : true" @change="statusChange" style="transform: scale(0.8,0.8)" />
|
|
|
+ <div class="tui-title">花材状态</div>
|
|
|
+ <div class="switch_bx">
|
|
|
<text v-if="form.status == 1">上架</text>
|
|
|
<text v-else>下架</text>
|
|
|
- </view>
|
|
|
+ </div>
|
|
|
</tui-list-cell>
|
|
|
|
|
|
- <tui-list-cell class="line-cell" :hover="false">
|
|
|
- <view class="tui-title">状态</view>
|
|
|
- <view class="switch_bx">
|
|
|
- <switch :checked="form.delStatus == 0 ? true : false" @change="delStatusChange" style="transform: scale(0.8,0.8)" />
|
|
|
- <text v-if="form.delStatus == 0">启用</text>
|
|
|
- <text v-else>停用</text>
|
|
|
- </view>
|
|
|
- </tui-list-cell>
|
|
|
+ </div>
|
|
|
|
|
|
- </view>
|
|
|
-
|
|
|
- <view class="module-com input-line-wrap goods-wrap">
|
|
|
- <view class="module-tit">
|
|
|
+ <div class="module-com input-line-wrap goods-wrap">
|
|
|
+ <div class="module-tit">
|
|
|
<span>花材图片</span>
|
|
|
- <span class="app-color-3">(建议比例 600X600)</span>
|
|
|
- </view>
|
|
|
+ <span class="app-color-3"></span>
|
|
|
+ </div>
|
|
|
<view class="module-det">
|
|
|
<htz-image-upload :max="1" :compress="true" v-model="currentImgData" :headers="headers"
|
|
|
@uploadSuccess="imgUploadSuccess" @imgDelete="imgDeleteFn" :action="getLoginInfo.imgUploadApi">
|
|
|
</htz-image-upload>
|
|
|
</view>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <view class="module-com input-line-wrap">
|
|
|
+
|
|
|
+ <tui-list-cell class="line-cell" :hover="false">
|
|
|
+ <view class="tui-title">大客价加价</view>
|
|
|
+ <input v-model="form.hjAddPrice" placeholder-class="phcolor" class="tui-input" name="hjAddPrice" placeholder="在成本价基础上多卖的金额" maxlength="50" type="digit" />
|
|
|
+ </tui-list-cell>
|
|
|
+
|
|
|
+ <tui-list-cell class="line-cell" :hover="false">
|
|
|
+ <div class="tui-title">批发价加价</div>
|
|
|
+ <input v-model="form.addPrice" placeholder-class="phcolor" class="tui-input" name="addPrice" @focus="form.addPrice=''" placeholder="在成本价基础上多卖的金额" maxlength="50" type="digit" />
|
|
|
+ </tui-list-cell>
|
|
|
+
|
|
|
+ <tui-list-cell class="line-cell" :hover="false">
|
|
|
+ <view class="tui-title">零售价加价</view>
|
|
|
+ <input v-model="form.skMore" placeholder-class="phcolor" class="tui-input" name="skMore" @focus="form.skMore=''" placeholder="在成本价基础上多卖的金额" maxlength="50" type="digit" />
|
|
|
+ </tui-list-cell>
|
|
|
+
|
|
|
+ <tui-list-cell class="line-cell" :hover="false">
|
|
|
+ <view class="tui-title">顺序值</view>
|
|
|
+ <input v-model="form.inTurn" placeholder-class="phcolor" class="tui-input" name="inTurn" @focus="form.inTurn=''" placeholder="请填写数字" type="number" />
|
|
|
+ </tui-list-cell>
|
|
|
+
|
|
|
+ <tui-list-cell class="line-cell" :hover="false">
|
|
|
+ <view class="tui-title">拆散单价</view>
|
|
|
+ <input v-model="form.smallRatio" @focus="form.smallRatio=''" placeholder-class="phcolor" class="tui-input" name="smallRatio" placeholder="请填写" maxlength="50"
|
|
|
+ type="number" style="width:160upx;border:1upx solid #cccccc;text-align:center;" />
|
|
|
+ <text style="margin-left:12upx;" v-if="Number(form.ratio)>0">X ¥{{parseFloat((Number(form.price)/Number(form.ratio)).toFixed(2))}} = ¥{{parseFloat((Number(form.smallRatio)*((Number(form.price)/Number(form.ratio)).toFixed(2))).toFixed(2))}}</text>
|
|
|
+ </tui-list-cell>
|
|
|
+
|
|
|
</view>
|
|
|
|
|
|
<view class="app-footer">
|
|
|
@@ -201,7 +179,18 @@
|
|
|
</view>
|
|
|
|
|
|
</form>
|
|
|
- </view>
|
|
|
+
|
|
|
+ <uni-popup ref="classRef" background-color="#fff" type="center" :animation="false" class="class-popup-style">
|
|
|
+ <view style="margin-left:30upx;margin-top:19upx;font-size:27upx;font-weight:bold;">请选择分类:</view>
|
|
|
+ <view style="display:flex;padding:20upx;height:auto;justify-content: space-between;align-items:center;flex-wrap:wrap;max-height:100vh;overflow:auto;">
|
|
|
+ <view v-for="(item, index) in itemClassData" :key="index" @tap.stop="setThisClass(item)" style="margin-bottom:20upx;margin-left:3upx;">
|
|
|
+ <image :src="item.cover" style="width:120upx;height:120upx;border-radius:10upx;"></image>
|
|
|
+ <view style="margin-top:5upx;overflow: hidden;white-space: nowrap;width:120upx;text-align:center;">{{item.name}}</view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </uni-popup>
|
|
|
+
|
|
|
+ </div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
@@ -228,20 +217,31 @@ export default {
|
|
|
id:0,
|
|
|
name:"",
|
|
|
py:"",
|
|
|
- stock:'',
|
|
|
+ stock:0,
|
|
|
ratio:'',
|
|
|
bigUnitId:1,
|
|
|
smallUnitId:2,
|
|
|
classId:'',
|
|
|
+ className:'',
|
|
|
price:'',
|
|
|
- skAddPrice:'',
|
|
|
- discountPrice:'',
|
|
|
+ skPrice:'',
|
|
|
+ hjPrice:'',
|
|
|
+ skMore:6,
|
|
|
+ addPrice:3,
|
|
|
+ hjAddPrice:2,
|
|
|
+ hjDiscountPrice:0,
|
|
|
+ discountPrice:0,
|
|
|
+ skDiscountPrice:0,
|
|
|
+ cost:0,
|
|
|
weight:1.5,
|
|
|
cover:[],
|
|
|
- stockWarning:'',
|
|
|
+ stockWarning:5,
|
|
|
status:2,
|
|
|
- delStatus:0,
|
|
|
itemId:0,
|
|
|
+ smallRatio:1,
|
|
|
+ ratioType:0,
|
|
|
+ inTurn:100,
|
|
|
+ cpInfo:[]
|
|
|
},
|
|
|
itemClassSelectedData:{},
|
|
|
itemClassData:[],
|
|
|
@@ -250,12 +250,31 @@ export default {
|
|
|
bigUnitSelectedData:{},
|
|
|
hasRequest:0,
|
|
|
productData:{id:0},
|
|
|
- headers:{token:''}
|
|
|
+ headers:{token:''},
|
|
|
+ backCpInfo:{cpId:0,cpName:'',needUpdate:0}
|
|
|
};
|
|
|
},
|
|
|
computed:{
|
|
|
- ...mapGetters(["getLoginInfo","getDictionariesInfo"]),
|
|
|
+ ...mapGetters(["getLoginInfo","getDictionariesInfo"])
|
|
|
},
|
|
|
+ onShow(){
|
|
|
+ let that = this
|
|
|
+ if(this.backCpInfo.needUpdate == 1){
|
|
|
+ let needAdd = 1;
|
|
|
+ if (!this.$util.isEmpty(this.form.cpInfo)) {
|
|
|
+ that.form.cpInfo.forEach((item) => {
|
|
|
+ if(item.cpId == that.backCpInfo.cpId){
|
|
|
+ needAdd = 0
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if(needAdd == 1){
|
|
|
+ that.form.cpInfo.push({cpId:that.backCpInfo.cpId,cpName:that.backCpInfo.cpName})
|
|
|
+ that.backCpInfo.needUpdate = 0
|
|
|
+ that.$forceUpdate()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
onLoad(option) {
|
|
|
if(option.id){
|
|
|
this.form.id = this.option.id
|
|
|
@@ -263,20 +282,104 @@ export default {
|
|
|
const token = uni.getStorageSync('token')
|
|
|
this.headers.token = token
|
|
|
},
|
|
|
- watch:{
|
|
|
- },
|
|
|
methods: {
|
|
|
+ delOneCp(info,index){
|
|
|
+ let that = this
|
|
|
+ that.$util.confirmModal({content:'确认删除'+info.cpName+'?'},() => {
|
|
|
+ that.form.cpInfo.splice(index,1)
|
|
|
+ that.$forceUpdate()
|
|
|
+ })
|
|
|
+ },
|
|
|
+ changeCp(item){
|
|
|
+ this.$util.pageTo({url: '/admin/cp/list?skip=1'})
|
|
|
+ },
|
|
|
+ changeClass(item){
|
|
|
+ this.$refs.classRef.open('center')
|
|
|
+ },
|
|
|
+ setThisClass(info){
|
|
|
+ this.$refs.classRef.close()
|
|
|
+ this.form.classId = info.id ? info.id : 0
|
|
|
+ this.form.className = info.name ? info.name : ''
|
|
|
+ this.$forceUpdate()
|
|
|
+ },
|
|
|
+ tjLinkage(){
|
|
|
+ if(this.form.discountPrice && Number(this.form.discountPrice)>0){
|
|
|
+ let skMore = this.form.skMore ? Number(this.form.skMore) : 0
|
|
|
+ let hjAddPrice = this.form.hjAddPrice ? Number(this.form.hjAddPrice) : 0
|
|
|
+ let addPrice = this.form.addPrice ? Number(this.form.addPrice) : 0
|
|
|
+
|
|
|
+ let skAddNum = Number(skMore) - Number(addPrice)
|
|
|
+ skAddNum = skAddNum.toFixed(2)
|
|
|
+ let skAmount = Number(skAddNum) + Number(this.form.discountPrice)
|
|
|
+ if(skAmount>0){
|
|
|
+ skAmount = skAmount.toFixed(2)
|
|
|
+ skAmount = parseFloat(skAmount)
|
|
|
+ this.form.skDiscountPrice = skAmount
|
|
|
+ }else{
|
|
|
+ this.form.skDiscountPrice = 0.01
|
|
|
+ }
|
|
|
+
|
|
|
+ let hjSubNum = Number(addPrice) - Number(hjAddPrice)
|
|
|
+ hjSubNum = hjSubNum.toFixed(2)
|
|
|
+ let hjAmount = Number(this.form.discountPrice) - Number(hjSubNum)
|
|
|
+ if(hjAmount > 0){
|
|
|
+ hjAmount = hjAmount.toFixed(2)
|
|
|
+ hjAmount = parseFloat(hjAmount)
|
|
|
+ this.form.hjDiscountPrice = hjAmount
|
|
|
+ }else{
|
|
|
+ this.form.hjDiscountPrice = 0.01
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ this.form.skDiscountPrice = 0
|
|
|
+ this.form.hjDiscountPrice = 0
|
|
|
+ }
|
|
|
+ },
|
|
|
+ priceLinkage(){
|
|
|
+ if(this.form.price && Number(this.form.price)>0){
|
|
|
+ let skMore = this.form.skMore ? Number(this.form.skMore) : 0
|
|
|
+ let hjAddPrice = this.form.hjAddPrice ? Number(this.form.hjAddPrice) : 0
|
|
|
+ let addPrice = this.form.addPrice ? Number(this.form.addPrice) : 0
|
|
|
+
|
|
|
+ let skAddNum = Number(skMore) - Number(addPrice)
|
|
|
+ skAddNum = skAddNum.toFixed(2)
|
|
|
+ let skAmount = Number(skAddNum) + Number(this.form.price)
|
|
|
+ if(skAmount>0){
|
|
|
+ skAmount = skAmount.toFixed(2)
|
|
|
+ skAmount = parseFloat(skAmount)
|
|
|
+ this.form.skPrice = skAmount
|
|
|
+ }else{
|
|
|
+ this.form.skPrice = ''
|
|
|
+ }
|
|
|
+
|
|
|
+ let hjSubNum = Number(addPrice) - Number(hjAddPrice)
|
|
|
+ hjSubNum = hjSubNum.toFixed(2)
|
|
|
+ let hjAmount = Number(this.form.price) - Number(hjSubNum)
|
|
|
+ if(hjAmount > 0){
|
|
|
+ hjAmount = hjAmount.toFixed(2)
|
|
|
+ hjAmount = parseFloat(hjAmount)
|
|
|
+ this.form.hjPrice = hjAmount
|
|
|
+ }else{
|
|
|
+ this.form.hjPrice = ''
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ this.form.skPrice = ''
|
|
|
+ this.form.hjPrice = ''
|
|
|
+ this.form.discountPrice = 0
|
|
|
+ this.form.skDiscountPrice = 0
|
|
|
+ this.form.hjDiscountPrice = 0
|
|
|
+ }
|
|
|
+ },
|
|
|
notModify(){
|
|
|
this.$msg('不可修改')
|
|
|
},
|
|
|
- goStockDetail(id){
|
|
|
- this.$util.pageTo({url: "/pagesStorehouse/stockWarn/detailed?id="+id})
|
|
|
+ goStockDetail(item){
|
|
|
+ this.$util.pageTo({url: "/pagesStorehouse/stockWarn/detailed?id="+item.id+'&name='+item.name})
|
|
|
},
|
|
|
statusChange(e){
|
|
|
this.form.status = e.detail.value ? 1 : 2;
|
|
|
},
|
|
|
- delStatusChange(e){
|
|
|
- this.form.delStatus = e.detail.value ? 0 : 1;
|
|
|
+ ratioTypeChange(e){
|
|
|
+ this.form.ratioType = e.detail.value
|
|
|
},
|
|
|
//如果库存被修改则花材状态变化
|
|
|
changeStock(event){
|
|
|
@@ -333,11 +436,13 @@ export default {
|
|
|
this.form.itemId = ptItemId
|
|
|
this.form.classId = ''
|
|
|
this.form.status = 1
|
|
|
- this.form.delStatus = 0
|
|
|
this.form.id = 0
|
|
|
this.form.price = ''
|
|
|
- this.form.skAddPrice =''
|
|
|
- this.form.discountPrice = ''
|
|
|
+ this.form.skMore = 6
|
|
|
+ this.form.addPrice = 3
|
|
|
+ this.form.hjAddPrice = 3
|
|
|
+ this.form.discountPrice = 0
|
|
|
+ this.form.cost = 0
|
|
|
})
|
|
|
},
|
|
|
getDetail() {
|
|
|
@@ -429,28 +534,48 @@ export default {
|
|
|
requestHost = updateProduct;
|
|
|
}else{
|
|
|
if(/(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/.test(this.form.stock) == false){
|
|
|
- uni.showToast({title:"请填写库存,没有请填0",icon:"none"})
|
|
|
+ uni.showToast({title:"请填写库存,没库存填0",icon:"none"})
|
|
|
return;
|
|
|
}
|
|
|
if(/(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/.test(this.form.discountPrice) == false){
|
|
|
- uni.showToast({title:"请填写特价,没有特价请填0",icon:"none"})
|
|
|
+ uni.showToast({title:"请填写特价,没特价填0",icon:"none"})
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(/(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/.test(this.form.cost) == false){
|
|
|
+ uni.showToast({title:"请填写成本",icon:"none"})
|
|
|
return;
|
|
|
}
|
|
|
if(/(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/.test(this.form.price) == false){
|
|
|
- uni.showToast({title:"请填写售价",icon:"none"})
|
|
|
+ uni.showToast({title:"请填写批发价",icon:"none"})
|
|
|
return;
|
|
|
}
|
|
|
- if(/(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/.test(this.form.skAddPrice) == false){
|
|
|
- uni.showToast({title:"请填写加价",icon:"none"})
|
|
|
+ if(/(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/.test(this.form.skPrice) == false){
|
|
|
+ uni.showToast({title:"请填写零售价",icon:"none"})
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(/(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/.test(this.form.hjPrice) == false){
|
|
|
+ uni.showToast({title:"请填写大客价",icon:"none"})
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(/(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/.test(this.form.addPrice) == false){
|
|
|
+ uni.showToast({title:"请填写批发价加价",icon:"none"})
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(/(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/.test(this.form.skMore) == false){
|
|
|
+ uni.showToast({title:"请填写零售价加价",icon:"none"})
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(/(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/.test(this.form.hjAddPrice) == false){
|
|
|
+ uni.showToast({title:"请填写大客价加价",icon:"none"})
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
let form = JSON.parse(JSON.stringify(this.form))
|
|
|
uni.showLoading({mask:true})
|
|
|
- requestHost({...form,cover:this.form.cover[0]}).then(res => {
|
|
|
+ requestHost({...form,cover:this.form.cover[0],appVersion:1}).then(res => {
|
|
|
uni.hideLoading()
|
|
|
if(res.code == 1){
|
|
|
- this.$msg("操作成功!")
|
|
|
+ this.$msg("操作成功!");
|
|
|
|
|
|
//返回上一页带参数
|
|
|
let pages = getCurrentPages();
|
|
|
@@ -463,9 +588,11 @@ export default {
|
|
|
|
|
|
uni.navigateBack({})
|
|
|
}
|
|
|
- })
|
|
|
+ });
|
|
|
},
|
|
|
+ // 表单验证
|
|
|
formSubmit(e) {
|
|
|
+ // 表单规则
|
|
|
let rules = [
|
|
|
{
|
|
|
name: "name",
|
|
|
@@ -492,24 +619,44 @@ export default {
|
|
|
msg: ["请选择小单位"]
|
|
|
},
|
|
|
{
|
|
|
- name: "ratio",
|
|
|
+ name: "price",
|
|
|
rule: ["required"],
|
|
|
- msg: ["请填写单位比"]
|
|
|
+ msg: ["请填写批发价"]
|
|
|
},
|
|
|
{
|
|
|
- name: "price",
|
|
|
+ name: "skPrice",
|
|
|
rule: ["required"],
|
|
|
- msg: ["请填写售价"]
|
|
|
+ msg: ["请填写零售价"]
|
|
|
},
|
|
|
{
|
|
|
- name: "skAddPrice",
|
|
|
+ name: "hjPrice",
|
|
|
rule: ["required"],
|
|
|
- msg: ["请填写加价"]
|
|
|
+ msg: ["请填写大客价"]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: "skMore",
|
|
|
+ rule: ["required"],
|
|
|
+ msg: ["请填写零售价加价"]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: "addPrice",
|
|
|
+ rule: ["required"],
|
|
|
+ msg: ["请填写批发价加价"]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: "hjAddPrice",
|
|
|
+ rule: ["required"],
|
|
|
+ msg: ["请填写大客价加价"]
|
|
|
},
|
|
|
{
|
|
|
name: "discountPrice",
|
|
|
rule: ["required"],
|
|
|
- msg: ["不做特价请填0"]
|
|
|
+ msg: ["没特价请填0"]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: "cost",
|
|
|
+ rule: ["required"],
|
|
|
+ msg: ["请填写成本"]
|
|
|
},
|
|
|
{
|
|
|
name: "weight",
|
|
|
@@ -524,15 +671,17 @@ export default {
|
|
|
{
|
|
|
name: "stockWarning",
|
|
|
rule: ["required"],
|
|
|
- msg: ["请填写库存预警值"]
|
|
|
+ msg: ["请填写库存预警"]
|
|
|
}
|
|
|
];
|
|
|
- let formData = e.detail.value
|
|
|
- let checkRes = form.validation(formData, rules)
|
|
|
+ // 进行表单检查
|
|
|
+ let formData = e.detail.value;
|
|
|
+ let checkRes = form.validation(formData, rules);
|
|
|
+ // 验证通过!
|
|
|
if (!checkRes) {
|
|
|
this.confirmFn()
|
|
|
} else {
|
|
|
- this.$msg(checkRes)
|
|
|
+ this.$msg(checkRes);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -543,6 +692,7 @@ export default {
|
|
|
min-height: calc(100vh - 100upx);
|
|
|
padding-bottom: 150upx;
|
|
|
}
|
|
|
+// 公共模块
|
|
|
.module-com {
|
|
|
margin-bottom: 20upx;
|
|
|
background-color: #fff;
|
|
|
@@ -581,4 +731,4 @@ export default {
|
|
|
width: 46%;
|
|
|
}
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|