-
+
输入>0的数,越小排序越前;重复则新者优先;0则默认排序
取消
@@ -372,25 +372,24 @@ export default {
saveEdit(row, type) {
row[type + 'PopoverVisible'] = false; // 关闭弹框
if(type == 'price') this.savePrice(row)
- if(type == 'sort') this.saveUpdateInfo(row, true)
+ if(type == 'sort') this.saveSort(row)
},
// 取消编辑
cancelEdit(row, type) {
row[type + 'PopoverVisible'] = false;
this.popoverFlag = false
// row[type + '_popover'] = false; // 关闭弹框
- this.$Message.info('已取消编辑');
+ // this.$Message.info('已取消编辑');
},
random() {
var randomNumber = Math.random();
return randomNumber
},
- savePrice(row){
+ async savePrice(row){
if (row.price === '') {
this.$message.warning('价格不能为空');
return;
}
- row.price_desc = getServicePriceDesc(row.price, row.price_unit, row.price_unit_num);
let obj = {}
obj.uid = this.uid
@@ -402,43 +401,28 @@ export default {
obj.unit_piece = row.price
}
- this.saveRequest('/agentnew/ajax_set_service_price', obj, row)
+ const res = await this.saveRequest('/agentnew/ajax_set_service_price', obj)
+ if(res) row.price_desc = getServicePriceDesc(row.price, row.price_unit, row.price_unit_num);
},
- onSwitchChange(row){
- row.is_index_display = row.is_index_display == "1" ? "0" : "1"
- this.saveUpdateInfo(row)
- },
- saveUpdateInfo(row, resort = false){
+ async onSwitchChange(row){
+ console.log(row)
let obj = {}
obj.uid = this.uid
obj.type = row.type
- obj.sort_id = row.sort_id
obj.is_index_display = row.is_index_display
- obj.is_display_price = row.is_display_price
- obj.is_recommend = row.is_recommend
- this.saveRequest('/agentnew/ajax_update_service_show', obj, row, resort)
+ const res = await this.saveRequest('/agentnew/ajax_update_service_show', obj)
+ if(!res) row.is_index_display = row.is_index_display === "1" ? "0" : "1"
},
- saveRequest(url, obj, row, resort = false){
- const that = this
- this.$http('POST', url, obj,{
- headers:{
- 'Auth': this.token
- }
- }).then(response => {
- if(response.status){
- that.$message.success('保存成功');
- this.$nextTick(() => {
- that.$set(that.serviceList, row)
- if(resort){
- this.sortServiceList()
- }
- })
- return true;
- }
- that.$message.error(response.info);
- }).catch(error => {
- console.error(error, 'error')
- })
+ async saveSort(row){
+ let obj = {}
+ obj.uid = this.uid
+ obj.type = row.type
+ obj.sort_id = row.sort_id
+ const res = await this.saveRequest('/agentnew/ajax_update_service_show', obj)
+ if(res) {
+ row.sort_id = row.edit_sort_id;
+ this.sortServiceList()
+ }
},
sortServiceList() {
const sortable = this.serviceList
@@ -454,6 +438,23 @@ export default {
return row;
});
},
+ async saveRequest(url, obj){
+ const that = this
+ return await this.$http('POST', url, obj,{
+ headers:{
+ 'Auth': this.token
+ }
+ }).then(response => {
+ if(response.status){
+ that.$message.success('保存成功');
+ return true;
+ }
+ that.$message.error(response.info);
+ return false;
+ }).catch(error => {
+ console.error(error, 'error')
+ })
+ },
popPayMentModal(row){
this.dialogVisible = true;
this.dialogTitle = row.type_desc + '-收款方式'
@@ -483,7 +484,7 @@ export default {
this.payList = payList
},
// 确认按钮事件
- handleConfirm() {
+ async handleConfirm() {
this.dialogVisible = false;
let obj = {}
@@ -504,9 +505,10 @@ export default {
});
obj.info = obj.info.substr(1, obj.info.length-1);
- if(hasClose) this.editRow.payment_method_desc = '自定义支付';
-
- this.saveRequest('/agentnew/ajax_payment_switch', obj, this.editRow)
+ const res = await this.saveRequest('/agentnew/ajax_payment_switch', obj, this.editRow)
+ if(res && hasClose) {
+ this.editRow.payment_method_desc = '自定义支付';
+ }
},
// 取消按钮事件
handleCancel() {