123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397 |
- <template>
- <div>
- <div >
- <el-input
- size="small"
- style="width: 200px;float: left"
- suffix-icon="el-icon-search"
- v-model="param.content.where.condition"
- placeholder="产品名称,编号"
- @keyup.enter.native="productData(param.content.pageNumber = 1)"
- @clear="productData(param.content.pageNumber = 1)"
- clearable>
- </el-input>
- <product_table style="float: right" :id="data.sa_projectid" ref="quoterPrice" @productAdd="productInitialization"></product_table>
- </div>
- <div class="produtMag-panel">
- <el-table
- ref="multipleTable"
- :data="list"
- style="width: 100%"
- :header-cell-style="{height:'50px',color:'#768093',fontWeight:'100'}"
- :cell-style="{height:'50px',color:'#768093',fontWeight:'200'}"
- @selection-change="selectionChange">
- <el-table-column
- type="selection"
- width="55">
- </el-table-column>
- <el-table-column
- align="center"
- label="产品图"
- width="100">
- <template slot-scope="scope">
- <div v-if="scope.row.attinfos[0]">
- <previewImage class="image" :image="scope.row.attinfos[0]" :list="scope.row.attinfos" :deletebtn="false"></previewImage>
- </div>
- </template>
- </el-table-column>
- <el-table-column
- prop="itemno"
- label="产品编号"
- width="180">
- </el-table-column>
- <el-table-column
- prop="itemname"
- label="产品名称"
- width="180">
- </el-table-column>
- <el-table-column
- label="型号/规格"
- width="180">
- <template slot-scope="scope">
- <p><span>{{scope.row.model}}</span> / <span>{{scope.row.spec}}</span></p>
- </template>
- </el-table-column>
- <el-table-column
- prop="caliber"
- label="口径"
- width="180">
- <template slot-scope="scope">
- <p><span>{{scope.row.caliber?scope.row.caliber:'--'}}</span></p>
- </template>
- </el-table-column>
- <el-table-column
- prop="pressure"
- label="压力"
- width="180">
- <template slot-scope="scope">
- <p><span>{{scope.row.pressure?scope.row.pressure:'--'}}</span></p>
- </template>
- </el-table-column>
- <el-table-column
- prop="material"
- label="材质"
- width="180">
- <template slot-scope="scope">
- <p><span>{{scope.row.material?scope.row.material:'--'}}</span></p>
- </template>
- </el-table-column>
- <el-table-column
- prop="brand"
- label="品牌"
- width="180">
- <template slot-scope="scope">
- <p v-for="(item,index) in scope.row.brand">
- <span style="float: left" v-if="index === scope.row.brand.length -1">{{item?item.brandname+'':'--'}}</span>
- <span style="float: left" v-else>{{item?item.brandname+',':'--'}}</span>
- </p>
- </template>
- </el-table-column>
- <el-table-column
- prop="itemclass"
- label="类别"
- width="180">
- <template slot-scope="scope">
- <p v-for="(item,index) in scope.row.itemclass">
- <span style="float: left" v-if="index === scope.row.itemclass.length -1">{{item?item.itemclassname+'':'--'}}</span>
- <span style="float: left" v-else>{{item?item.itemclassname+',':'--'}}</span>
- </p>
- </template>
- </el-table-column>
- <el-table-column
- prop="unitid"
- label="计量单位"
- width="100">
- <template slot-scope="scope">
- <el-tag size="mini" type="info" effect="plain">{{scope.row.unitname}}/{{scope.row.axunitname}}</el-tag>
- </template>
- </el-table-column>
- <el-table-column
- prop="num"
- label="数量"
- width="180">
- <template slot-scope="scope">
- <el-input-number v-model="scope.row.qty" size="mini" :min="1" label="描述文字" @change="onChangeNum(scope.row.qty,scope.row,scope.$index)"></el-input-number>
- </template>
- </el-table-column>
- <el-table-column
- prop="marketprice"
- label="牌价"
- width="100">
- <template slot-scope="scope">
- <p><span>{{scope.row.marketprice?scope.row.marketprice:'--'}}</span></p>
- </template>
- </el-table-column>
- <el-table-column
- prop="discountrate"
- label="折扣(%)"
- width="100">
- <template slot-scope="scope">
- <el-input v-model="scope.row.discountrate" size="mini" placeholder="请输入折扣" @change="onChangeDiscountrate(scope.row.discountrate,scope.row,scope.$index)"></el-input>
- </template>
- </el-table-column>
- <el-table-column
- prop="price"
- label="单价"
- width="100">
- <template slot-scope="scope">
- <el-input v-model="scope.row.price" size="mini" placeholder="请输入单价" @change="onChangePrice(scope.row.price,scope.row,scope.$index)"></el-input>
- </template>
- </el-table-column>
- <el-table-column
- prop="amount"
- label="金额"
- width="100">
- <template slot-scope="scope">
- <p><span>{{scope.row.amount}}</span></p>
- </template>
- </el-table-column>
- <el-table-column
- prop="specialoffer"
- label="是否特价"
- width="100">
- <template slot-scope="scope">
- <i class="el-icon-check" v-if="scope.row.specialoffer === 1" style="color: red;font-size: 20px"></i>
- </template>
- </el-table-column>
- <el-table-column
- prop="operation"
- label="操作"
- width="100">
- <template slot-scope="scope">
- <el-button size="mini" type="text" @click="deleteProduct(scope.row)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- <div style="margin-top:16px;text-align:right">
- <el-pagination
- background
- small
- @size-change="handleSizeChange"
- @current-change="handleCurrentChange"
- :current-page="currentPage"
- :page-size="param.content.pageSize"
- layout="total, prev, pager, next, jumper"
- :total="total">
- </el-pagination>
- </div>
- </div>
- </div>
- </template>
- <script>
- import uploadFile from "@/components/upload/hw_obs_upload";
- import previewImage from "@/components/previewImage";
- import product_table from '../components/productTable'
- export default {
- props:["data"],
- name: "productInventory",
- components:{uploadFile, previewImage,product_table},
- data(){
- return {
- tablecols:[],
- list:[],
- total:0,
- currentPage:0,
- changeList:[],
- param:{
- "id": 20221021095503,
- "version":1,
- "content": {
- "sa_quotedpriceid":'',
- "pageNumber": 1,
- "pageSize": 20,
- "where": {
- "condition": ""
- }
- }
- }
- }
- },
- methods:{
- /*产品配置信息新增初始化*/
- async productInitialization(id){
- this.param.content.sa_quotedpriceid = id
- const res = await this.$api.requested(this.param)
- this.list = res.data
- this.total = res.total
- for (var i=0 ;i<this.list.length;i++){
- this.list[i].discountrate = this.list[i].discountrate * 100
- }
- console.log(this.list,'产品配置信息')
- },
- /*产品配置信息*/
- async productData(id){
- this.param.content.sa_quotedpriceid = id
- const res = await this.$api.requested(this.param)
- this.list = res.data
- this.total = res.total
- for (var i=0 ;i<this.list.length;i++){
- this.list[i].discountrate = this.list[i].discountrate * 100
- }
- console.log(this.list,'产品配置信息')
- },
- /*修改折扣或单价的时候刷新*/
- async productDiscountrateData(id){
- this.param.content.sa_quotedpriceid = id
- const res = await this.$api.requested(this.param)
- this.list = res.data
- this.total = res.total
- for (var i=0 ;i<this.list.length;i++){
- this.list[i].discountrate = this.list[i].discountrate * 100
- }
- console.log(this.list,'产品配置信息')
- },
- handleSizeChange(val) {
- // console.log(`每页 ${val} 条`);
- this.param.content.pageSize = val
- this.productData()
- },
- handleCurrentChange(val) {
- // console.log(`当前页: ${val}`);
- this.param.content.pageNumber = val
- this.productData()
- },
- onSuccess(){
- this.productData()
- },
- clearData(){
- this.search = ""
- this.param.content.where.condition = this.search
- this.productData()
- },
- queryClick(){
- this.param.content.where.condition = this.search
- this.productData()
- },
- selectionChange(){},
- checkForm(){
- this.$emit('checkForm')
- },
- quoterPrice(id,type){
- console.log(id,"报价单id")
- console.log(type,"项目报价")
- this.$refs.quoterPrice.queryProduct(id,type)
- },
- onChangeNum (val,data,index) {
- console.log(val,data,index)
- /* data.amount = data.qty * data.price*/
- this.$set(this.list,index,data)
- this.$nextTick(()=>{
- let obj = this.list.map(e=>{
- return {
- sa_quotedprice_itemsid:e.sa_quotedprice_itemsid,
- itemid:e.itemid,
- oldprice:e.marketprice,
- price:e.price,
- discountrate:(e.discountrate/100).toFixed(4),
- qty:e.qty
- }
- })
- this.changeData(obj)
- })
- },
- onChangeDiscountrate(val,data,index) {
- /* data.price = data.marketprice * (data.discountrate / 100)
- data.amount = (data.qty * data.price).toFixed(2)*/
- this.$set(this.list,index,data)
- this.$nextTick(()=>{
- let obj = this.list.map(e=>{
- return {
- sa_quotedprice_itemsid:e.sa_quotedprice_itemsid,
- itemid:e.itemid,
- oldprice:e.marketprice,
- price:0,
- discountrate:(e.discountrate/100).toFixed(4),
- qty:e.qty
- }
- })
- this.changeDiscountrateData(obj)
- })
- },
- onChangePrice(val,data,index){
- /*data.discountrate = ((data.price / data.marketprice) * 100).toFixed(2)
- data.amount = data.qty * data.price*/
- this.$set(this.list,index,data)
- this.$nextTick(()=>{
- this.objSet(this.list)
- })
- },
- objSet(data){
- let obj = data.map(e=>{
- return {
- sa_quotedprice_itemsid:e.sa_quotedprice_itemsid,
- itemid:e.itemid,
- oldprice:e.marketprice,
- price:e.price,
- discountrate:0,
- qty:e.qty
- }
- })
- this.changeDiscountrateData(obj)
- },
- async changeData(obj){
- console.log(this.list,"数据")
- const res = await this.$api.requested({
- "id": 20221021095403,
- "version":1,
- "content": {
- "sa_quotedpriceid":this.list[0].sa_quotedpriceid, //sat_notice_classid<=0时 为新增
- "items":obj
- }
- })
- console.log(res)
- this.productData(res.data[0].sa_quotedpriceid)
- },
- async changeDiscountrateData(obj){
- console.log(this.list,"数据")
- const res = await this.$api.requested({
- "id": 20221021095403,
- "version":1,
- "content": {
- "sa_quotedpriceid":this.list[0].sa_quotedpriceid, //sat_notice_classid<=0时 为新增
- "items":obj
- }
- })
- console.log(res)
- this.productDiscountrateData(res.data[0].sa_quotedpriceid)
- },
- async deleteProduct(val){
- console.log(val)
- const res = await this.$api.requested({
- "id": 20221021095603,
- "version":1,
- "content": {
- "sa_quotedprice_itemsids":[val.sa_quotedprice_itemsid] //sat_notice_classid<=0时 为新增
- }
- })
- this.tool.showMessage(res,()=>{
- this.productData(val.sa_quotedpriceid)
- })
- }
- },
- mounted() {
- console.log(this.data)
- this.productData(this.data.sa_quotedpriceid)
- }
- }
- </script>
- <style scoped>
- .produtMag-panel{
- margin-top: 35px;
- background: #fff;
- border-radius:5px;
- border:1px solid rgb(0 0 0 / 5%)
- /* box-shadow: 0 5px 5px rgb(0 0 0 / 10%);
- transform: translate3d(0,-2px,0); */
- }
- .image {
- width:80px;height:80px;margin:0px auto;
- }
- </style>
|