| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198 |
- <template>
- <div>
- <el-button size="small" type="text" @click="onShow(drawer = true)">添加产品</el-button>
- <el-drawer
- title="添加产品"
- :visible.sync="drawer"
- append-to-body
- direction="rtl"
- size="80%">
- <div class="drawer__panel">
- <el-table
- ref="multipleTable"
- :data="list"
- style="width: 100%"
- :header-cell-style="{height:'50px',color:'#606266',fontWeight:'400'}"
- :cell-style="{height:'50px',color:'#666666',fontWeight:'400'}">
- <el-table-column
- align="center"
- label="产品图"
- width="80">
- <template slot-scope="scope">
- <div v-if="scope.row.attinfos[0]">
- <previewImage style="height:38px;width:38px" :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="型号/规格">
- <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">
- </el-table-column>
- <el-table-column
- prop="pressure"
- label="压力"
- width="180">
- </el-table-column>
- <el-table-column
- prop="material"
- label="材质"
- width="180">
- </el-table-column>
- <el-table-column
- prop="brand"
- label="品牌"
- width="180">
- <template slot-scope="scope">
- <p v-for="(item,index) in scope.row.brand" :key="index">
- <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" :key="index">
- <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="marketprice"
- label="牌价"
- width="100">
- </el-table-column>
- <el-table-column
- label="操作"
- width="90"
- fixed="right">
- <template slot-scope="scope">
- <el-button type="text" size="small" @click="addProduct(scope.row)">添加</el-button>
- </template>
- </el-table-column>
- </el-table>
- <div class="container normal-panel" style="text-align:right">
- <el-pagination
- background
- @size-change="handleSizeChange"
- @current-change="handleCurrentChange"
- :current-page="currentPage"
- :page-sizes="[20, 50, 100, 200]"
- layout="total,sizes, prev, pager, next, jumper"
- :total="total">
- </el-pagination>
- </div>
- </div>
- </el-drawer>
- </div>
- </template>
- <script>
- import previewImage from '@/components/previewImage/index.vue'
- export default {
- props:['id','mainData'],
- components:{
- previewImage
- },
- data () {
- return {
- drawer:false,
- param:{
- "id": 20221208105403,
- "version":1,
- "content": {
- "sa_projectid":this.id
- }
- },
- list:[],
- currentPage:0,
- total:0
- }
- },
- methods:{
- async listData () {
- this.param.content.sa_salesforecastbillid = this.$route.query.id
- const res = await this.$api.requested(this.param)
- this.list = res.data
- this.total = res.total
- this.currentPage = res.pageNumber
- },
- handleSizeChange(val) {
- // console.log(`每页 ${val} 条`);
- this.param.content.pageSize = val
- this.listData()
- },
- handleCurrentChange(val) {
- // console.log(`当前页: ${val}`);
- this.param.content.pageNumber = val
- this.listData()
- },
- onShow () {
- console.log(this.mainData)
- this.listData()
- },
- async addProduct (row) {
- console.log(row,"添加商品")
- row.sa_salesforecastid = 0
- const res = await this.$api.requested({
- "id": 20220906155003,
- "version":1,
- "content": {
- "sa_salesforecastmodelid":this.mainData.sa_salesforecastmodelid,
- "sa_salesforecastbillid":this.$route.query.id,
- "sa_projectid":this.id,
- "itemclassinfos": [{
- "sa_salesforecastid":0,
- "itemid":row.itemid,
- "itemclassnum":'',
- "orderqty": 1,
- "orderamount": row.marketprice,
- "invoiceqty": 1,
- "invoiceamount": row.marketprice,
- "outqty": 1,
- "outamount": row.marketprice
- }]
- }
- })
- this.tool.showMessage(res,()=>{
- this.$emit('onSuccess')
- this.listData()
- })
- }
- },
- mounted () {
-
- }
- }
- </script>
- <style>
- </style>
|