|
|
@@ -3,8 +3,21 @@
|
|
|
<el-col :span="setcol">
|
|
|
<div class="flex-align-center normal-margin">
|
|
|
<slot name="operation"></slot>
|
|
|
- <el-button v-if="data.status === '新建'" class="inline-16" :disabled="data.type === '特殊订单'" size="small" type="primary" @click="drawer = true">{{setcol === 24?'添 加':'取 消'}}</el-button>
|
|
|
+<!-- <el-button v-if="data.status === '新建'" class="inline-16" :disabled="data.type === '特殊订单'" size="small" type="primary" @click="drawer = true">{{setcol === 24?'添 加':'取 消'}}</el-button>-->
|
|
|
+ <addProduct class="inline-16" v-if="type !== 'confirmdate' && data.status === '新建' && data.type !== '特殊订单' " :drawer="drawer" :data="data" ref="addProduct"
|
|
|
+ :params="paramsAdd" :tablecolsAdd="tablecolsAdd" title="添 加" :tradefield="data.tradefield"
|
|
|
+ @addSuccess="addProducts" @addProduct="addProduct" @uploadData="uploadData" @closeDrawer="listData"
|
|
|
+ ></addProduct>
|
|
|
<excel class="inline-16" :tablecols="columnTitle" :param="param" :total="total" :excelTitle="excelTitle"></excel>
|
|
|
+ <uploadAllData
|
|
|
+ v-if="type !== 'confirmdate' && data.status === '新建' && data.type !== '特殊订单' "
|
|
|
+ :total="total"
|
|
|
+ @onSuccess="listData()"
|
|
|
+ @handlePullApi="handlePullApi"
|
|
|
+ @handleDelApi="handleDelApi"
|
|
|
+ idName="sa_orderitemsid"
|
|
|
+ type="del"
|
|
|
+ ></uploadAllData>
|
|
|
</div>
|
|
|
<p v-if="data.status === '新建'" class="normal-margin" style="font-size: 13px !important;color:red;font-weight: normal">{{checkFreefreightamount}}</p>
|
|
|
<el-table
|
|
|
@@ -235,8 +248,9 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import addProduct from '@/template/orderCanUseProduct/index.vue'
|
|
|
-
|
|
|
+// import addProduct from '@/template/orderCanUseProduct/index.vue'
|
|
|
+import addProduct from '@/template/addProduct/index'
|
|
|
+import uploadAllData from '@/components/uploadAllData/index'
|
|
|
export default {
|
|
|
props:['data','type'],
|
|
|
data () {
|
|
|
@@ -251,7 +265,7 @@ export default {
|
|
|
param:{
|
|
|
"id": 20221109093902,
|
|
|
"content": {
|
|
|
- "sa_orderid": 0, //订单ID
|
|
|
+ "sa_orderid": this.$route.query.id, //订单ID
|
|
|
"pageNumber": 1,
|
|
|
"pageSize": 20,
|
|
|
"where": {
|
|
|
@@ -267,7 +281,19 @@ export default {
|
|
|
total:0,
|
|
|
currentPage:0,
|
|
|
time: null,
|
|
|
- value2:''
|
|
|
+ value2:'',
|
|
|
+ paramsAdd:{
|
|
|
+ "id": null,
|
|
|
+ "content": {
|
|
|
+ "sa_orderid": this.$route.query.id, //订单ID
|
|
|
+ "pageNumber": 1,
|
|
|
+ "pageSize": 100,
|
|
|
+ "where": {
|
|
|
+ "condition": ""
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
+ tablecolsAdd:[]
|
|
|
}
|
|
|
},
|
|
|
computed:{
|
|
|
@@ -290,7 +316,8 @@ export default {
|
|
|
components:{
|
|
|
/*excel:() => import('../export_excel'),*/
|
|
|
excel:() => import('../details/export_excel'),
|
|
|
- addProduct
|
|
|
+ addProduct,
|
|
|
+ uploadAllData
|
|
|
},
|
|
|
methods:{
|
|
|
|
|
|
@@ -433,7 +460,93 @@ export default {
|
|
|
},
|
|
|
})
|
|
|
this.freefreightamount = res.data.freefreightamount?res.data.freefreightamount:0
|
|
|
- }
|
|
|
+ },
|
|
|
+ /*批量添加商品*/
|
|
|
+ async addProducts(data){
|
|
|
+ let items = data.map(item => {
|
|
|
+ return {
|
|
|
+ sa_orderitemsid:0,
|
|
|
+ itemid:item.itemid,
|
|
|
+ qty:item.orderminqty,
|
|
|
+ needdate:item.deliverydate
|
|
|
+ }
|
|
|
+ })
|
|
|
+ const res = await this.$api.requested({
|
|
|
+ "id": 20221109093602,
|
|
|
+ "content": {
|
|
|
+ "sa_orderid": this.$route.query.id, //订单ID
|
|
|
+ "sys_enterpriseid": this.data.sys_enterpriseid, //企业ID
|
|
|
+ "type": this.data.type, //订单类型
|
|
|
+ "items": items
|
|
|
+ },
|
|
|
+ })
|
|
|
+ this.tool.showMessage(res,()=>{
|
|
|
+ this.listData()
|
|
|
+ this.$refs.addProduct.list = []
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /*单个添加商品*/
|
|
|
+ async addProduct(data){
|
|
|
+ let res = await this.$api.requested({
|
|
|
+ "id": 20221109093602,
|
|
|
+ "content": {
|
|
|
+ "sa_orderid": this.$route.query.id,
|
|
|
+ "sys_enterpriseid": this.data.sys_enterpriseid, //企业ID
|
|
|
+ "type": this.data.type, //订单类型
|
|
|
+ "items": [
|
|
|
+ {
|
|
|
+ "sa_orderitemsid": 0,
|
|
|
+ "needdate": data.deliverydate,
|
|
|
+ "qty": data.orderminqty,
|
|
|
+ 'itemid':data.itemid,
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ })
|
|
|
+ this.tool.showMessage(res,() => {
|
|
|
+ this.listData()
|
|
|
+ this.$refs.addProduct.listData()
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /*一键添加*/
|
|
|
+ uploadData(uploadApi,data){
|
|
|
+ uploadApi.id = 20221109093602
|
|
|
+ uploadApi.content = {
|
|
|
+ "sa_orderid": this.$route.query.id,
|
|
|
+ "sys_enterpriseid": this.data.sys_enterpriseid, //企业ID
|
|
|
+ "type": this.data.type, //订单类型
|
|
|
+ "items": data.map(e=>{
|
|
|
+ return {
|
|
|
+ "sa_orderitemsid": 0,
|
|
|
+ "needdate": e.deliverydate,
|
|
|
+ "qty": e.orderminqty,
|
|
|
+ 'itemid':e.itemid,
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ this.listData()
|
|
|
+ this.$refs.addProduct.list = []
|
|
|
+ },
|
|
|
+
|
|
|
+ handlePullApi (pullApi) {
|
|
|
+ pullApi.content = {
|
|
|
+ "sa_orderid": 0, //订单ID
|
|
|
+ "pageNumber": 1,
|
|
|
+ "pageSize": 20,
|
|
|
+ "where": {
|
|
|
+ "condition": ""
|
|
|
+ }
|
|
|
+ }
|
|
|
+ pullApi.id = 20221109093902
|
|
|
+ pullApi.content.sa_orderid = this.$route.query.id
|
|
|
+ },
|
|
|
+ handleDelApi (delApi,data) {
|
|
|
+ delApi.id = 20221109093702
|
|
|
+ delApi.content = {
|
|
|
+ "sa_orderid":this.$route.query.id,
|
|
|
+ "sa_orderitemsids": data
|
|
|
+ }
|
|
|
+ },
|
|
|
},
|
|
|
mounted () {
|
|
|
this.listData()
|
|
|
@@ -448,6 +561,9 @@ export default {
|
|
|
})
|
|
|
// console.log(this.columnTitle)
|
|
|
},
|
|
|
+ created() {
|
|
|
+ this.tablecolsAdd = this.tool.tabelCol(this.$route.name).addProductTable.tablecols
|
|
|
+ },
|
|
|
watch:{
|
|
|
value2 (val) {
|
|
|
console.log(val)
|