|
|
@@ -96,14 +96,13 @@
|
|
|
</view>
|
|
|
</tui-list-cell>
|
|
|
|
|
|
- <tui-list-cell class="line-cell" :arrow="true">
|
|
|
+ <tui-list-cell class="line-cell" :hover="false">
|
|
|
<view class="tui-title">所属产品</view>
|
|
|
- <input v-model="form.cpId" name="cpId" type="text" hidden />
|
|
|
- <view style="color:#CCCCCC;width:450upx;height:45upx;" @click.stop="changeCp()" v-if="form.cpId == 0">
|
|
|
- 请选择产品
|
|
|
- </view>
|
|
|
- <view @click.stop="changeCp()" style="width:450upx;height:45upx;" v-else>
|
|
|
- {{form.cpName}}
|
|
|
+ <view>
|
|
|
+ <block v-if="productData.cpInfo && !$util.isEmpty(productData.cpInfo)">
|
|
|
+ <button v-for="(cpItem, cpIndex) in productData.cpInfo" class="admin-button-com blue mini-btn" style="margin-right:8upx;" @click.stop="delOneCp(cpItem)">{{cpItem.cpName}} ×</button>
|
|
|
+ </block>
|
|
|
+ <button class="admin-button-com default mini-btn" @click.stop="changeCp()">添加产品</button>
|
|
|
</view>
|
|
|
</tui-list-cell>
|
|
|
|
|
|
@@ -283,6 +282,7 @@ import TuiListCell from "@/components/plugin/list-cell";
|
|
|
const form = require("@/utils/formValidation.js");
|
|
|
import { getAllItemClass } from "@/api/item-class";
|
|
|
import { applyAuth } from '@/api/item';
|
|
|
+import { delCpItem,addCpItem } from '@/api/cp'
|
|
|
import { getAllUnit } from "@/api/unit";
|
|
|
import { addProduct,updateProduct,getProductDetail,py,print,modifyOnStockFn,delStatusUpdate } from "@/api/product";
|
|
|
import { getPtItemDetail } from "@/api/pt-item";
|
|
|
@@ -314,8 +314,6 @@ export default {
|
|
|
smallUnitId:2,
|
|
|
classId:'',
|
|
|
className:'',
|
|
|
- cpId:'',
|
|
|
- cpName:'',
|
|
|
price:'',
|
|
|
skPrice:'',
|
|
|
hjPrice:'',
|
|
|
@@ -373,6 +371,7 @@ export default {
|
|
|
|
|
|
},
|
|
|
onShow(){
|
|
|
+ let that = this
|
|
|
//重复花材,删除花材之后,返回上一页花材,需要刷新
|
|
|
if(this.onShowRefresh == 1){
|
|
|
if(this.hasRequest == 0){
|
|
|
@@ -381,13 +380,28 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
if(this.backCpInfo.needUpdate == 1){
|
|
|
- this.backCpInfo.needUpdate = 0
|
|
|
- this.form.cpId = this.backCpInfo.cpId
|
|
|
- this.form.cpName = this.backCpInfo.cpName
|
|
|
- this.$forceUpdate()
|
|
|
+ addCpItem({cpId:that.backCpInfo.cpId,productId:that.productData.id}).then(res=>{
|
|
|
+ if(res.code == 1){
|
|
|
+ that.$msg(res.msg)
|
|
|
+ that.hasRequest = 0
|
|
|
+ that.init()
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ delOneCp(cp){
|
|
|
+ let that = this
|
|
|
+ that.$util.confirmModal({content:'确认删除'+cp.cpName+'?'},() => {
|
|
|
+ delCpItem({id:cp.id}).then(res=>{
|
|
|
+ if(res.code == 1){
|
|
|
+ that.$msg(res.msg)
|
|
|
+ that.hasRequest = 0
|
|
|
+ that.init()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
changeCp(item){
|
|
|
this.$util.pageTo({url: '/admin/cp/list?skip=1'})
|
|
|
},
|