|
@@ -0,0 +1,157 @@
|
|
|
|
+<template>
|
|
|
|
+ <div>
|
|
|
|
+ <div>
|
|
|
|
+ <div style="display:flex">
|
|
|
|
+ <el-input size="small" style="width:200px;margin-right:10px" v-model="params.content.condition" placeholder="输入搜索内容" @clear="listData(params.content.pageNumber = 1)" @keyup.native.enter="listData(params.content.pageNumber = 1)" clearable></el-input>
|
|
|
|
+ <slot name="addProduct"/>
|
|
|
|
+ </div>
|
|
|
|
+ <tableLayout :layout="tablecols" :data="list" :opwidth="200" height="calc(100vh - 550px)" :custom="true" fixedName="operation qty marketprice discountrate price countPrice" >
|
|
|
|
+ <template v-slot:customcol="scope">
|
|
|
|
+ <div v-if="scope.column.columnname == 'qty'">
|
|
|
|
+ <el-input-number size="mini" v-if="editIndex == scope.column.data.sa_contract_itemsid" v-model="form.qty" @change="qtyChange" :min="1" :max="10" label="描述文字"></el-input-number>
|
|
|
|
+ <span v-else>{{scope.column.data.qty}}</span>
|
|
|
|
+ </div>
|
|
|
|
+ <div v-else-if="scope.column.columnname == 'attinfos'">
|
|
|
|
+ <previewImage
|
|
|
|
+ v-if="scope.column.data.attinfos[0]"
|
|
|
|
+ style="width:80px;height:80px;margin-top:0px"
|
|
|
|
+ class="image"
|
|
|
|
+ :image="scope.column.data.attinfos[0]"
|
|
|
|
+ :list="scope.column.data.attinfos"
|
|
|
|
+ :deletebtn="false"
|
|
|
|
+ ></previewImage>
|
|
|
|
+ </div>
|
|
|
|
+ <div v-else-if="scope.column.columnname == 'discountrate'">
|
|
|
|
+ <el-input size="mini" v-if="editIndex == scope.column.data.sa_contract_itemsid" v-model="form.discountrate" @input="discountrateChange($event,scope.column.data)"></el-input>
|
|
|
|
+ <p v-else>{{scope.column.data[scope.column.columnname]}}</p>
|
|
|
|
+ </div>
|
|
|
|
+ <div v-else-if="scope.column.columnname == 'price'">
|
|
|
|
+ <el-input size="mini" v-if="editIndex == scope.column.data.sa_contract_itemsid" v-model="form.price" @input="priceChange($event,scope.column.data)"></el-input>
|
|
|
|
+ <p v-else>{{scope.column.data[scope.column.columnname]}}</p>
|
|
|
|
+ </div>
|
|
|
|
+ <div v-else-if="scope.column.columnname == 'countPrice'">
|
|
|
|
+ <p>{{scope.column.data.price * scope.column.data.qty}}</p>
|
|
|
|
+ </div>
|
|
|
|
+ <div v-else-if="scope.column.columnname == 'brand'">
|
|
|
|
+ {{scope.column.data[scope.column.columnname][0].brandname}}
|
|
|
|
+ </div>
|
|
|
|
+ <p v-else>{{scope.column.data[scope.column.columnname]}}</p>
|
|
|
|
+ </template>
|
|
|
|
+ <template v-slot:opreation="scope">
|
|
|
|
+ <el-button v-if="editIndex == scope.data.sa_contract_itemsid" type="text" size="mini" @click="save" class="inline-16">保 存</el-button>
|
|
|
|
+ <slot name="edit" :data="scope.data" v-else></slot>
|
|
|
|
+ <slot name="del" :data="scope.data"></slot>
|
|
|
|
+ <!-- <edit :data="scope.data"></edit> -->
|
|
|
|
+ </template>
|
|
|
|
+ </tableLayout>
|
|
|
|
+ </div>
|
|
|
|
+ <div style="margin-top:16px;text-align:right">
|
|
|
|
+ <el-pagination
|
|
|
|
+ background
|
|
|
|
+ small
|
|
|
|
+ @size-change="handleSizeChange"
|
|
|
|
+ @current-change="handleCurrentChange"
|
|
|
|
+ :current-page="params.content.pageNumber"
|
|
|
|
+ :page-size="params.content.pageSize"
|
|
|
|
+ layout="total, prev, pager, next, jumper"
|
|
|
|
+ :total="total">
|
|
|
|
+ </el-pagination>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+</template>
|
|
|
|
+
|
|
|
|
+<script>
|
|
|
|
+// import edit from './editProduct'
|
|
|
|
+import addProduct from './addProduct'
|
|
|
|
+import previewImage from '@/components/previewImage/index'
|
|
|
|
+export default {
|
|
|
|
+ components: {addProduct,previewImage},
|
|
|
|
+ name: '',
|
|
|
|
+ data() {
|
|
|
|
+ return {
|
|
|
|
+ list:[],
|
|
|
|
+ params: {
|
|
|
|
+ "id": 20221122165302,
|
|
|
|
+ "content": {
|
|
|
|
+ "sa_contractid": '',
|
|
|
|
+ "pageNumber": 1,
|
|
|
|
+ "pageSize": 20,
|
|
|
|
+ "where": {
|
|
|
|
+ "condition": ""
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ form: {
|
|
|
|
+ qty:'',
|
|
|
|
+ discountrate:'',
|
|
|
|
+ price:'',
|
|
|
|
+ },
|
|
|
|
+ tablecols:[],
|
|
|
|
+ total:0,
|
|
|
|
+ editIndex:''
|
|
|
|
+ };
|
|
|
|
+ },
|
|
|
|
+ computed:{
|
|
|
|
+ },
|
|
|
|
+ watch:{
|
|
|
|
+ },
|
|
|
|
+ created () {
|
|
|
|
+ if (this.$route.query.id) this.listData()
|
|
|
|
+ this.tablecols = this.tool.tabelCol(this.$route.name).productBillnoTable.tablecols
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ async listData(){
|
|
|
|
+ this.params.content.sa_contractid = this.$route.query.id
|
|
|
|
+ const res = await this.$api.requested(this.params)
|
|
|
|
+ this.list = res.data
|
|
|
|
+ this.total = res.total
|
|
|
|
+ console.log('触发了');
|
|
|
|
+ },
|
|
|
|
+ qtyChange (num) {
|
|
|
|
+ this.form.qty = num
|
|
|
|
+ console.log(num);
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ handleChange(num) {
|
|
|
|
+ console.log(num);
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ discountrateChange (num,data) {
|
|
|
|
+ this.form.discountrate = num
|
|
|
|
+ this.form.price = this.form.discountrate * data.marketprice
|
|
|
|
+ },
|
|
|
|
+ priceChange (num,data) {
|
|
|
|
+ this.form.price = num
|
|
|
|
+ this.form.discountrate = this.form.price / data.marketprice
|
|
|
|
+ console.log(this.form.price,data.marketprice);
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ async save () {
|
|
|
|
+ let res = await this.$api.requested({
|
|
|
|
+ "id": 20221122200302,
|
|
|
|
+ "content": {
|
|
|
|
+ "sa_contractid":this.$route.query.id,
|
|
|
|
+ "items": [this.form]
|
|
|
|
+ },
|
|
|
|
+ })
|
|
|
|
+ this.tool.showMessage(res,() => {
|
|
|
|
+ this.editIndex = ''
|
|
|
|
+ this.listData()
|
|
|
|
+ this.$emit('editSuccess',res.data.signamount)
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ handleSizeChange(val) {
|
|
|
|
+ // console.log(`每页 ${val} 条`);
|
|
|
|
+ this.params.content.pageSize = val
|
|
|
|
+ },
|
|
|
|
+ handleCurrentChange(val) {
|
|
|
|
+ // console.log(`当前页: ${val}`);
|
|
|
|
+ this.params.content.pageNumber = val
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+};
|
|
|
|
+</script>
|
|
|
|
+
|
|
|
|
+<style scoped>
|
|
|
|
+
|
|
|
|
+</style>
|