Commit 622ecb99 by zhangquan

限制6位整数并保留2位小数

1 parent 9a3d9274
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<span class="price">¥{{ salePrice || '--' }}</span> <span class="price">¥{{ salePrice || '--' }}</span>
<img :src="require('@/assets/images/edit.png')" alt="" @click="editPrice"> <img :src="require('@/assets/images/edit.png')" alt="" @click="editPrice">
</div> </div>
<el-input v-else v-focus clearable v-model="salePrice" onkeyup="value = value ? value.replace(/^0\d/g, '0').replace(/[^\d.]/g, '').replace(/^\./g, '').replace(/\.{2,}/g, '').replace('.', '$#$') <el-input v-else v-focus clearable v-model="salePrice" onkeyup="value = value ? value.replace(/^0\d/g, '0').replace(/[^\d.]/g, '').replace(/^\./g, '').replace(/^\d{6}\d+(\.\d+)?/g, value.substr(0,6)).replace(/\.{2,}/g, '').replace('.', '$#$')
.replace(/\./g, '').replace('$#$', '.').replace(/^(-)*(\d+)\.(\d\d).*$/, '$1$2.$3') : value" type="text" @blur="setPriceFn"></el-input> .replace(/\./g, '').replace('$#$', '.').replace(/^(-)*(\d+)\.(\d\d).*$/, '$1$2.$3') : value" type="text" @blur="setPriceFn"></el-input>
</div> </div>
<span class="buy-num">起购数量:{{goodsInfo.startQty}}件</span> <span class="buy-num">起购数量:{{goodsInfo.startQty}}件</span>
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
</li> </li>
</ul> </ul>
<div class="operate-btn"> <div class="operate-btn">
<el-button type="primary" v-if="goodsInfo.goodsPosition==1" @click="handleSale">上架销售</el-button> <el-button type="primary" :disabled="goodsInfo.shelvesStatus == 1002" v-if="goodsInfo.goodsPosition==1" @click="handleSale">上架销售</el-button>
<el-button type="primary" v-if="goodsInfo.goodsPosition==2" plain @click="handleOff">下架至仓库</el-button> <el-button type="primary" v-if="goodsInfo.goodsPosition==2" plain @click="handleOff">下架至仓库</el-button>
<el-button type="primary" v-if="goodsInfo.goodsPosition==1" plain @click="handleRemove">移出仓库</el-button> <el-button type="primary" v-if="goodsInfo.goodsPosition==1" plain @click="handleRemove">移出仓库</el-button>
</div> </div>
...@@ -144,12 +144,14 @@ export default { ...@@ -144,12 +144,14 @@ export default {
background: 'rgba(0, 0, 0, 0.3)' background: 'rgba(0, 0, 0, 0.3)'
}) })
this.$apis.platformGoods.goodsDetailApi({id}).then(res =>{ this.$apis.platformGoods.goodsDetailApi({id}).then(res =>{
this.editing = false
loading.close() loading.close()
if(res?.id){ if(res?.id){
this.goodsInfo = res this.goodsInfo = res
this.salePrice = res.salePrice this.salePrice = res.salePrice
} }
}).catch(err=>{ }).catch(err=>{
this.editing = false
loading.close() loading.close()
console.log(err) console.log(err)
}) })
...@@ -170,7 +172,6 @@ export default { ...@@ -170,7 +172,6 @@ export default {
if(res){ if(res){
this.$message.success('操作成功') this.$message.success('操作成功')
} }
this.editing = false
this.getDetailById() this.getDetailById()
}) })
}, },
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
</el-tooltip> </el-tooltip>
</div> </div>
<div class="setPriceSlot" slot="setPriceSlot" slot-scope="scope"> <div class="setPriceSlot" slot="setPriceSlot" slot-scope="scope">
<el-input ref="priceRef" v-focus v-if="curEditId==scope.scope.id" v-model="scope.scope.salePrice" onkeyup="value = value ? value.replace(/^0\d/g, '0').replace(/[^\d.]/g, '').replace(/^\./g, '').replace(/\.{2,}/g, '').replace('.', '$#$') <el-input ref="priceRef" v-focus v-if="curEditId==scope.scope.id" v-model="scope.scope.salePrice" onkeyup="value = value ? value.replace(/^0\d/g, '0').replace(/[^\d.]/g, '').replace(/^\./g, '').replace(/^\d{6}\d+(\.\d+)?/g, value.substr(0,6)).replace(/\.{2,}/g, '').replace('.', '$#$')
.replace(/\./g, '').replace('$#$', '.').replace(/^(-)*(\d+)\.(\d\d).*$/, '$1$2.$3') : value" type="text" clearable @blur="setPriceFn($event, scope.scope)"></el-input> .replace(/\./g, '').replace('$#$', '.').replace(/^(-)*(\d+)\.(\d\d).*$/, '$1$2.$3') : value" type="text" clearable @blur="setPriceFn($event, scope.scope)"></el-input>
<span class="unedited" v-else> <span class="unedited" v-else>
{{scope.scope.salePrice}} {{scope.scope.salePrice}}
...@@ -323,11 +323,11 @@ export default { ...@@ -323,11 +323,11 @@ export default {
} }
} }
this.$apis.platformGoods.modifyPriceApi(params).then(res=>{ this.$apis.platformGoods.modifyPriceApi(params).then(res=>{
this.handleSearch()
if(res){ if(res){
this.$message.success('操作成功') this.$message.success('操作成功')
this.handleClose() this.handleClose()
} }
this.handleSearch()
}) })
}, },
handleReset(){ handleReset(){
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<GLDialog title="批量改价" mode="small" :visible.sync="visible" :show-close="true" :before-close="handleClose" @onOk="confirmPriceChange" @onCancel="handleClose" okText="提交" cancelText="取消"> <GLDialog title="批量改价" mode="small" :visible.sync="visible" :show-close="true" :before-close="handleClose" @onOk="confirmPriceChange" @onCancel="handleClose" okText="提交" cancelText="取消">
<div class="dialog-wrap"> <div class="dialog-wrap">
<span>销售价 = 供货价 +</span> <span>销售价 = 供货价 +</span>
<el-input size="small" type="text" onkeyup="value = value ? value.replace(/^0\d/g, '0').replace(/[^\d.]/g, '').replace(/^\./g, '').replace(/\.{2,}/g, '').replace('.', '$#$') <el-input size="small" type="text" onkeyup="value = value ? value.replace(/^0\d/g, '0').replace(/[^\d.]/g, '').replace(/^\./g, '').replace(/^\d{6}\d+(\.\d+)?/g, value.substr(0,6)).replace(/\.{2,}/g, '').replace('.', '$#$')
.replace(/\./g, '').replace('$#$', '.').replace(/^(-)*(\d+)\.(\d\d).*$/, '$1$2.$3') : value" v-model="batchPrice" placeholder="请输入金额"> .replace(/\./g, '').replace('$#$', '.').replace(/^(-)*(\d+)\.(\d\d).*$/, '$1$2.$3') : value" v-model="batchPrice" placeholder="请输入金额">
<span slot="append">元</span> <span slot="append">元</span>
</el-input> </el-input>
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<span class="price">¥{{ salePrice || '--' }}</span> <span class="price">¥{{ salePrice || '--' }}</span>
<img :src="require('@/assets/images/edit.png')" alt="" @click="editPrice"> <img :src="require('@/assets/images/edit.png')" alt="" @click="editPrice">
</div> </div>
<el-input v-else v-focus clearable v-model="salePrice" onkeyup="value = value ? value.replace(/^0\d/g, '0').replace(/[^\d.]/g, '').replace(/^\./g, '').replace(/\.{2,}/g, '').replace('.', '$#$') <el-input v-else v-focus clearable v-model="salePrice" onkeyup="value = value ? value.replace(/^0\d/g, '0').replace(/[^\d.]/g, '').replace(/^\./g, '').replace(/^\d{6}\d+(\.\d+)?/g, value.substr(0,6)).replace(/\.{2,}/g, '').replace('.', '$#$')
.replace(/\./g, '').replace('$#$', '.').replace(/^(-)*(\d+)\.(\d\d).*$/, '$1$2.$3') : value" type="text" @blur="setPriceFn"></el-input> .replace(/\./g, '').replace('$#$', '.').replace(/^(-)*(\d+)\.(\d\d).*$/, '$1$2.$3') : value" type="text" @blur="setPriceFn"></el-input>
</div> </div>
<span class="buy-num">起购数量:{{goodsInfo.startQty}}件</span> <span class="buy-num">起购数量:{{goodsInfo.startQty}}件</span>
...@@ -144,12 +144,14 @@ export default { ...@@ -144,12 +144,14 @@ export default {
background: 'rgba(0, 0, 0, 0.3)' background: 'rgba(0, 0, 0, 0.3)'
}) })
this.$apis.platformGoods.goodsDetailApi({id}).then(res =>{ this.$apis.platformGoods.goodsDetailApi({id}).then(res =>{
this.editing = false
loading.close() loading.close()
if(res?.id){ if(res?.id){
this.goodsInfo = res this.goodsInfo = res
this.salePrice = res.salePrice this.salePrice = res.salePrice
} }
}).catch(err=>{ }).catch(err=>{
this.editing = false
loading.close() loading.close()
console.log(err) console.log(err)
}) })
...@@ -170,7 +172,6 @@ export default { ...@@ -170,7 +172,6 @@ export default {
if(res){ if(res){
this.$message.success('操作成功') this.$message.success('操作成功')
} }
this.editing = false
this.getDetailById() this.getDetailById()
}) })
}, },
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
</el-tooltip> </el-tooltip>
</div> </div>
<div slot="setPriceSlot" slot-scope="scope"> <div slot="setPriceSlot" slot-scope="scope">
<el-input type="text" v-model="scope.scope.salePrice" onkeyup="value = value ? value.replace(/^0\d/g, '0').replace(/[^\d.]/g, '').replace(/^\./g, '').replace(/\.{2,}/g, '').replace('.', '$#$') <el-input type="text" v-model="scope.scope.salePrice" onkeyup="value = value ? value.replace(/^0\d/g, '0').replace(/[^\d.]/g, '').replace(/^\./g, '').replace(/^\d{6}\d+(\.\d+)?/g, value.substr(0,6)).replace(/\.{2,}/g, '').replace('.', '$#$')
.replace(/\./g, '').replace('$#$', '.').replace(/^(-)*(\d+)\.(\d\d).*$/, '$1$2.$3') : value" @blur="setPriceFn($event, scope.scope)" placeholder="请输入"></el-input> .replace(/\./g, '').replace('$#$', '.').replace(/^(-)*(\d+)\.(\d\d).*$/, '$1$2.$3') : value" @blur="setPriceFn($event, scope.scope)" placeholder="请输入"></el-input>
</div> </div>
<div slot="auth-button" slot-scope="scope"> <div slot="auth-button" slot-scope="scope">
...@@ -270,11 +270,11 @@ export default { ...@@ -270,11 +270,11 @@ export default {
} }
} }
this.$apis.platformGoods.modifyPriceApi(params).then(res=>{ this.$apis.platformGoods.modifyPriceApi(params).then(res=>{
this.handleSearch()
if(res){ if(res){
this.$message.success('操作成功') this.$message.success('操作成功')
this.handleClose() this.handleClose()
} }
this.handleSearch()
}) })
}, },
// 点击批量上架 // 点击批量上架
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!