|
@@ -46,7 +46,7 @@
|
|
销售单号:
|
|
销售单号:
|
|
<a-input placeholder="请输入销售单号" v-model.trim="form.salesBillNo" :maxLength="50" @change="fetchUser" @blur="handleBlur"/>
|
|
<a-input placeholder="请输入销售单号" v-model.trim="form.salesBillNo" :maxLength="50" @change="fetchUser" @blur="handleBlur"/>
|
|
<span class="mleft">{{ buyerName }}</span>
|
|
<span class="mleft">{{ buyerName }}</span>
|
|
- <a-button type="primary" :disabled="disabled" @click="handleSave" class="button-error">设置完成</a-button>
|
|
|
|
|
|
+ <a-button type="primary" v-if="salesBillSnList&&salesBillSnList.length>0" :disabled="disabled" @click="handleSave('salesBillNo')" class="button-error">设置完成</a-button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<a-divider>请给以下产品设置新的退货单价</a-divider>
|
|
<a-divider>请给以下产品设置新的退货单价</a-divider>
|
|
@@ -84,7 +84,7 @@
|
|
</template>
|
|
</template>
|
|
</s-table>
|
|
</s-table>
|
|
</div>
|
|
</div>
|
|
- <grabOrderModal ref="grabOrder" :infoData="objInfo" :openModal="openGrabOrderModal" @ok="handleGrabOrderOk" @close="closeGrabOrder"></grabOrderModal>
|
|
|
|
|
|
+ <grabOrderModal ref="grabOrder" :infoData="listInfo" :openModal="openGrabOrderModal" @ok="handleGrabOrderOk" @close="closeGrabOrder"></grabOrderModal>
|
|
</a-spin>
|
|
</a-spin>
|
|
</a-modal>
|
|
</a-modal>
|
|
</template>
|
|
</template>
|
|
@@ -95,6 +95,7 @@ import debounce from 'lodash/debounce'
|
|
import { STable, VSelect } from '@/components'
|
|
import { STable, VSelect } from '@/components'
|
|
import { salesDetailByNo } from '@/api/sales'
|
|
import { salesDetailByNo } from '@/api/sales'
|
|
import { setReturnPrice } from '@/api/salesReturnDetail'
|
|
import { setReturnPrice } from '@/api/salesReturnDetail'
|
|
|
|
+import { grabSalesBill } from '@/api/salesReturn'
|
|
import grabOrderModal from './grabOrderModal.vue'
|
|
import grabOrderModal from './grabOrderModal.vue'
|
|
export default {
|
|
export default {
|
|
name: 'SetPriceModal',
|
|
name: 'SetPriceModal',
|
|
@@ -161,7 +162,8 @@ export default {
|
|
},
|
|
},
|
|
buyerName: '',
|
|
buyerName: '',
|
|
openGrabOrderModal: false,
|
|
openGrabOrderModal: false,
|
|
- objInfo: null,
|
|
|
|
|
|
+ listInfo: null,
|
|
|
|
+ noShowBillSnList: null,
|
|
salesBillSnList: []
|
|
salesBillSnList: []
|
|
}
|
|
}
|
|
},
|
|
},
|
|
@@ -186,22 +188,63 @@ export default {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
const productArr = this.chooseData.map(item => { return { productSn: item.productSn, code: item.productEntity.code, salesReturnDetailSn: item.salesReturnDetailSn } })
|
|
const productArr = this.chooseData.map(item => { return { productSn: item.productSn, code: item.productEntity.code, salesReturnDetailSn: item.salesReturnDetailSn } })
|
|
- this.objInfo = {
|
|
|
|
|
|
+ const objInfo = {
|
|
salesReturnBillSn: this.$route.params.sn,
|
|
salesReturnBillSn: this.$route.params.sn,
|
|
salesBillNo: this.form.salesBillNo,
|
|
salesBillNo: this.form.salesBillNo,
|
|
productList: productArr
|
|
productList: productArr
|
|
}
|
|
}
|
|
- this.openGrabOrderModal = true
|
|
|
|
|
|
+ grabSalesBill(objInfo).then(res => {
|
|
|
|
+ const newList = res.data
|
|
|
|
+ const _this = this
|
|
|
|
+ if (newList && newList.length > 0) {
|
|
|
|
+ const flag = newList.some(item => Object.keys(item).length > 2)
|
|
|
|
+ if (flag) {
|
|
|
|
+ this.listInfo = newList.filter(con => Object.keys(con).length > 2)
|
|
|
|
+ this.openGrabOrderModal = true
|
|
|
|
+ const noShowList = newList.filter(con => Object.keys(con).length <= 2)
|
|
|
|
+ this.noShowBillSnList = _this.getNewSalesBillList(noShowList)
|
|
|
|
+ } else {
|
|
|
|
+ const resultVal = _this.getNewSalesBillList(newList)
|
|
|
|
+ this.salesBillSnList = resultVal
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ getNewSalesBillList (list) {
|
|
|
|
+ const resultVal = list.map(item => {
|
|
|
|
+ const nameArr = Object.getOwnPropertyNames(item)
|
|
|
|
+ let newName = ''
|
|
|
|
+ nameArr.forEach(con => {
|
|
|
|
+ if (con != 'product') {
|
|
|
|
+ newName = con
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ const newobj = {
|
|
|
|
+ salesReturnDetailSn: item.product.salesReturnDetailSn, salesBillDetailSn: item[newName].salesBillDetailSn
|
|
|
|
+ }
|
|
|
|
+ return newobj
|
|
|
|
+ })
|
|
|
|
+ return resultVal
|
|
},
|
|
},
|
|
handleGrabOrderOk (con) {
|
|
handleGrabOrderOk (con) {
|
|
- this.salesBillSnList = con
|
|
|
|
|
|
+ if (this.noShowBillSnList && this.noShowBillSnList.length > 0) {
|
|
|
|
+ this.salesBillSnList = this.salesBillSnList.concat(con)
|
|
|
|
+ } else {
|
|
|
|
+ this.salesBillSnList = con
|
|
|
|
+ }
|
|
},
|
|
},
|
|
closeGrabOrder () {
|
|
closeGrabOrder () {
|
|
- this.objInfo = null
|
|
|
|
|
|
+ this.listInfo = null
|
|
this.openGrabOrderModal = false
|
|
this.openGrabOrderModal = false
|
|
},
|
|
},
|
|
// 设置价格
|
|
// 设置价格
|
|
- handleSave () {
|
|
|
|
|
|
+ handleSave (type) {
|
|
|
|
+ if (type && type === 'salesBillNo') {
|
|
|
|
+ if (!this.buyerName) {
|
|
|
|
+ this.$message.warning('请输入正确的销售单号!')
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ }
|
|
// 不抓单且打折
|
|
// 不抓单且打折
|
|
if (this.form.grabFlag == 0 && this.form.discountFlag == 1) {
|
|
if (this.form.grabFlag == 0 && this.form.discountFlag == 1) {
|
|
if (!this.form.discount) {
|
|
if (!this.form.discount) {
|
|
@@ -220,8 +263,9 @@ export default {
|
|
this.form.salesReturnBillDetailList = this.salesBillSnList
|
|
this.form.salesReturnBillDetailList = this.salesBillSnList
|
|
} else {
|
|
} else {
|
|
const snList = []
|
|
const snList = []
|
|
|
|
+ this.form.salesBillNo = ''
|
|
this.chooseData.map(item => {
|
|
this.chooseData.map(item => {
|
|
- snList.push(item.salesReturnDetailSn)
|
|
|
|
|
|
+ snList.push({ salesReturnDetailSn: item.salesReturnDetailSn })
|
|
})
|
|
})
|
|
this.form.salesReturnBillDetailList = snList
|
|
this.form.salesReturnBillDetailList = snList
|
|
}
|
|
}
|