Commit bf6123f8 by zhangquan

详情bug修复

1 parent ef9c51ff
...@@ -18,7 +18,11 @@ ...@@ -18,7 +18,11 @@
<div class="sale-price"> <div class="sale-price">
<div class="set-price"> <div class="set-price">
<label for="">销售价</label> <label for="">销售价</label>
<el-input clearable v-model="salePrice" onkeyup="value = value ? value.replace(/^0\d/g, '0').replace(/[^\d.]/g, '').replace(/^\./g, '').replace(/\.{2,}/g, '').replace('.', '$#$') <div v-if="!editing" class="edit">
<span class="price">¥{{ salePrice }}</span>
<img :src="require('@/assets/images/edit.png')" alt="" @click="editPrice">
</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('.', '$#$')
.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>
...@@ -26,7 +30,7 @@ ...@@ -26,7 +30,7 @@
<ul class="attr-list"> <ul class="attr-list">
<li v-for="item in attrList" :key="item.key"> <li v-for="item in attrList" :key="item.key">
<span class="attr-label">{{ item.label }}</span> <span class="attr-label">{{ item.label }}</span>
<span class="attr-key">{{ goodsInfo[item.key] || '--' }}</span> <span class="attr-key"><span v-if="item.key == 'sellPrice' || item.key == 'marketPrice'">¥</span>{{ goodsInfo[item.key] || '--' }}</span>
</li> </li>
<li v-if=" goodsInfo.specificationResponses && goodsInfo.specificationResponses[0] && goodsInfo.specificationResponses[0].specName"> <li v-if=" goodsInfo.specificationResponses && goodsInfo.specificationResponses[0] && goodsInfo.specificationResponses[0].specName">
<span class="attr-label">{{ goodsInfo.specificationResponses[0].specName }}</span> <span class="attr-label">{{ goodsInfo.specificationResponses[0].specName }}</span>
...@@ -66,11 +70,11 @@ const attrList = [ ...@@ -66,11 +70,11 @@ const attrList = [
// key: 'goodsCharacteristic' // key: 'goodsCharacteristic'
// }, // },
{ {
label:'供货价(元)', label:'供货价',
key: 'sellPrice' key: 'sellPrice'
}, },
{ {
label:'市场价(元)', label:'市场价',
key: 'marketPrice' key: 'marketPrice'
}, },
{ {
...@@ -94,7 +98,8 @@ export default { ...@@ -94,7 +98,8 @@ export default {
salePrice: '', salePrice: '',
curImgIdx: 0, curImgIdx: 0,
curTitle: 1, curTitle: 1,
goodsInfo: {} goodsInfo: {},
editing: false
} }
}, },
computed:{ computed:{
...@@ -107,11 +112,21 @@ export default { ...@@ -107,11 +112,21 @@ export default {
created() { created() {
this.getDetailById() this.getDetailById()
}, },
directives: {
// focus指令名称
focus: {
inserted(el) {
el.querySelector('input').focus()
},
},
},
mounted() { mounted() {
}, },
methods: { methods: {
editPrice(){
this.editing = true
},
getDetailById(){ getDetailById(){
const { id } = this.$route.params const { id } = this.$route.params
this.$apis.platformGoods.goodsDetailApi({id}).then(res =>{ this.$apis.platformGoods.goodsDetailApi({id}).then(res =>{
...@@ -137,6 +152,7 @@ export default { ...@@ -137,6 +152,7 @@ export default {
if(res){ if(res){
this.$message.success('操作成功') this.$message.success('操作成功')
} }
this.editing = false
this.getDetailById() this.getDetailById()
}) })
}, },
...@@ -248,6 +264,22 @@ export default { ...@@ -248,6 +264,22 @@ export default {
justify-content: space-between; justify-content: space-between;
.set-price{ .set-price{
display: flex; display: flex;
.edit{
display: flex;
align-items: center;
img{
width: 20px;
height: 20px;
vertical-align: middle;
margin-left: 16px;
cursor: pointer;
}
.price{
font-weight: 500;
font-size: 28px;
color: #EB4E4E;
}
}
label{ label{
white-space: nowrap; white-space: nowrap;
margin-right: 16px; margin-right: 16px;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!