|
@@ -59,7 +59,9 @@ const seeDetail = new Vue({
|
|
|
townList:[],
|
|
|
productsArr:[],
|
|
|
isLoading:true,
|
|
|
+ abnormalProductList:[],// 成本异常商品
|
|
|
goodsDialogVisible:false,
|
|
|
+ abnormalDialogVisible:false,
|
|
|
productRadio:null,
|
|
|
checkedProductList:[],
|
|
|
total:0,
|
|
@@ -98,7 +100,12 @@ const seeDetail = new Vue({
|
|
|
computed: {
|
|
|
disabled() {
|
|
|
return this.productRadio === null
|
|
|
- }
|
|
|
+ },
|
|
|
+ checkedConfirmFlag(){
|
|
|
+ if(this.confirmParam.cityId && this.checkedProductList.length > 0 ){
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ },
|
|
|
},
|
|
|
methods: {
|
|
|
// 计算总运费
|
|
@@ -126,38 +133,38 @@ const seeDetail = new Vue({
|
|
|
}
|
|
|
},
|
|
|
getProvinceOptions(){ // 获取全部省份
|
|
|
- const _self = this;
|
|
|
+ const _this = this;
|
|
|
OrderApi.GetAddressSelect({},function(res){
|
|
|
if(res.code === 0 && res.data){
|
|
|
- _self.provinceList = res.data;
|
|
|
+ _this.provinceList = res.data;
|
|
|
}else{
|
|
|
CAIMEI.Alert(res.msg,'确定',false);
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
getCityList(parentId){// 获取地区
|
|
|
- const _self = this;
|
|
|
+ const _this = this;
|
|
|
this.cityList = [];
|
|
|
this.townList = [];
|
|
|
this.addressForm.cityId = '';
|
|
|
this.addressForm.townId = '';
|
|
|
OrderApi.GetAddressSelect({ parentId: parentId,type:1 },function(res){
|
|
|
if(res.code === 0 && res.data){
|
|
|
- _self.cityList = res.data;
|
|
|
+ _this.cityList = res.data;
|
|
|
}else{
|
|
|
CAIMEI.Alert(res.msg,'确定',false);
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
getTownList(parentId){
|
|
|
- const _self = this;
|
|
|
+ const _this = this;
|
|
|
this.townList = [];
|
|
|
this.addressForm.townId = '';
|
|
|
this.confirmParam.cityId = this.prosParams.cityId = this.addressForm.cityId
|
|
|
console.log('cityId',this.confirmParam.cityId)
|
|
|
OrderApi.GetAddressSelect({parentId: parentId,type:2},function(res){
|
|
|
if(res.code === 0 && res.data){
|
|
|
- _self.townList = res.data;
|
|
|
+ _this.townList = res.data;
|
|
|
}else{
|
|
|
CAIMEI.Alert(res.msg,'确定',false);
|
|
|
}
|
|
@@ -170,8 +177,34 @@ const seeDetail = new Vue({
|
|
|
}
|
|
|
},
|
|
|
handleConfirm(){
|
|
|
- this.checkedDataForm()
|
|
|
- this.checkedInvoiceForm()
|
|
|
+ // 校验收货信息
|
|
|
+ this.$refs['dataForm'].validate(async valid => {
|
|
|
+ if (valid) {
|
|
|
+ if(this.productsArr.length === 0){
|
|
|
+ this.$alert('请添加商品~', '提示', {
|
|
|
+ type: 'warning',
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ // 校验发票
|
|
|
+ if(this.invoiceForm.type!==0){
|
|
|
+ this.$refs['invoiceForm'].validate(async valid => {
|
|
|
+ if (valid) {
|
|
|
+ if(this.checkedConfirmFlag){
|
|
|
+ this.initializationParams()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }else {
|
|
|
+ if(this.checkedConfirmFlag){
|
|
|
+ this.initializationParams()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //统一处理
|
|
|
+ initializationParams(){
|
|
|
// 发票信息
|
|
|
if(this.invoiceForm.type!==0){
|
|
|
this.invoiceForm.type = parseInt(this.invoiceForm.type)
|
|
@@ -220,8 +253,13 @@ const seeDetail = new Vue({
|
|
|
SupplierApi.shopGenerateOrder(params,function(response){
|
|
|
if(response.code === 0){
|
|
|
const data = response.data
|
|
|
- _this.$message({ message: '订单提交成功~',type: 'success'})
|
|
|
+ _this.$notify({
|
|
|
+ title: '成功',
|
|
|
+ message: '订单已提交~',
|
|
|
+ type: 'success'
|
|
|
+ });
|
|
|
setTimeout(()=>{
|
|
|
+ _this.formatConfirmParam()
|
|
|
window.location.href = '/supplier/order/detail.html?shopOrderId='+data.shopOrderId
|
|
|
},2000)
|
|
|
}else{
|
|
@@ -238,27 +276,7 @@ const seeDetail = new Vue({
|
|
|
this.confirmParam.orderInvoice = JSON.parse(this.confirmParam.orderInvoice);
|
|
|
console.log('payInfo',this.confirmParam.payInfo)
|
|
|
},
|
|
|
- // 校验地址
|
|
|
- checkedDataForm(){
|
|
|
- this.$refs['dataForm'].validate(async valid => {
|
|
|
- if (valid) {
|
|
|
- if(this.productsArr.length === 0){
|
|
|
- this.$alert('请添加商品~', '提示', {
|
|
|
- type: 'warning',
|
|
|
- confirmButtonText: '确定',
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- // 校验发票
|
|
|
- checkedInvoiceForm(){
|
|
|
- this.$refs['invoiceForm'].validate(async valid => {
|
|
|
- if (valid) {
|
|
|
- return true
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
+ // 添加商品弹窗显示
|
|
|
handleShowVisible(){
|
|
|
this.getProductList()
|
|
|
this.goodsDialogVisible = true
|
|
@@ -285,13 +303,11 @@ const seeDetail = new Vue({
|
|
|
// 删除确认商品
|
|
|
handleDelete(index){
|
|
|
this.checkedProductList.splice(index, 1)
|
|
|
- console.log('checkedProductList',this.checkedProductList)
|
|
|
if(this.checkedProductList.length === 0){
|
|
|
this.productsArr = []
|
|
|
}
|
|
|
if(this.checkedProductList.length > 0){
|
|
|
this.prosParams.productInfo = this.handleProStringify(this.checkedProductList)
|
|
|
- console.log('prosParams',this.prosParams)
|
|
|
this.getSettlement(this.prosParams)
|
|
|
}
|
|
|
},
|
|
@@ -299,9 +315,7 @@ const seeDetail = new Vue({
|
|
|
handleAddProConfirm(){
|
|
|
this.checkedProductList = [...this.checkedProductList,...this.productRadio]
|
|
|
this.prosParams.productInfo = this.handleProStringify(this.checkedProductList)
|
|
|
- console.log('prosParams',this.prosParams)
|
|
|
this.getSettlement(this.prosParams)
|
|
|
- this.handleCanle()
|
|
|
},
|
|
|
// 统一格式化确认订单商品信息参数
|
|
|
handleProStringify(productInfo){
|
|
@@ -320,19 +334,29 @@ const seeDetail = new Vue({
|
|
|
this.orderInfoArray =[]
|
|
|
SupplierApi.getSettlement(params,function(response){
|
|
|
if(response.code === 0){
|
|
|
- let data = response.data.shop
|
|
|
- _this.supplier = data
|
|
|
- console.log('supplier', _this.supplier)
|
|
|
- _this.orderInfoArray.push(_this.supplier)
|
|
|
- console.log('orderInfoArray', _this.orderInfoArray)
|
|
|
- _this.hanldShouldPayFee = data.totalPrice;
|
|
|
- _this.supplier.handlePostageFlag = data.postageFlag
|
|
|
- _this.productsArr = data.cartList
|
|
|
+ let data = response.data
|
|
|
+ if(data.abnormalProductList.length > 0){
|
|
|
+ _this.abnormalProductList = data.abnormalProductList
|
|
|
+ _this.abnormalDialogVisible = true
|
|
|
+ }else{
|
|
|
+ _this.supplier = data.shop
|
|
|
+ _this.orderInfoArray.push(_this.supplier)
|
|
|
+ _this.hanldShouldPayFee = data.shop.totalPrice;
|
|
|
+ _this.supplier.handlePostageFlag = data.shop.postageFlag
|
|
|
+ _this.productsArr = data.shop.cartList
|
|
|
+ _this.handleCanle()
|
|
|
+ }
|
|
|
}else{
|
|
|
-
|
|
|
+ _this.$message.error(response.msg)
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ // 隐藏提示
|
|
|
+ handleAbnormalDialogVisible(){
|
|
|
+ // this.productRadio = null
|
|
|
+ // this.checkedProductList = []
|
|
|
+ this.abnormalDialogVisible = false
|
|
|
+ },
|
|
|
// 选择商品
|
|
|
handleSelectionChange(row) {
|
|
|
this.productRadio = row
|
|
@@ -355,10 +379,10 @@ const seeDetail = new Vue({
|
|
|
},
|
|
|
},
|
|
|
mounted () {
|
|
|
- const _self = this;
|
|
|
+ const _this = this;
|
|
|
this.getProvinceOptions();
|
|
|
if (isPC) {
|
|
|
- _self.open = true;
|
|
|
+ _this.open = true;
|
|
|
}
|
|
|
if(globalUserData){
|
|
|
this.listQuery.shopId = this.confirmParam.shopId = globalUserData.shopId;
|
|
@@ -369,9 +393,9 @@ const seeDetail = new Vue({
|
|
|
var isCSS1Compat = ((document.compatMode || "") === "CSS1Compat"); // 判断渲染模式是不是标准模式
|
|
|
var scrollHeight = supportPageOffset ? window.pageYOffset : isCSS1Compat ? document.documentElement.scrollTop : document.body.scrollTop;
|
|
|
if (scrollHeight < 100) {
|
|
|
- _self.isFiexd = true
|
|
|
+ _this.isFiexd = true
|
|
|
} else {
|
|
|
- _self.isFiexd = false
|
|
|
+ _this.isFiexd = false
|
|
|
}
|
|
|
});
|
|
|
},
|