|  |  | 
 |  |  |         .ibox-content { | 
 |  |  |             background-color: rgba(240, 242, 245, 1); | 
 |  |  |         } | 
 |  |  |         label { | 
 |  |  |         .aside label { | 
 |  |  |             width: 100%; | 
 |  |  |             margin: 5px 0 !important; | 
 |  |  |         } | 
 |  |  | 
 |  |  | </head> | 
 |  |  | <div class="ibox-content" id="app"> | 
 |  |  |     <el-container> | 
 |  |  |         <el-aside style="width: 300px; background-color: white; padding: 10px;"> | 
 |  |  |         <el-aside class="aside" style="width: 300px; background-color: white; padding: 10px;"> | 
 |  |  |             <el-row style="border-bottom: #E4E7ED 1px solid;"> | 
 |  |  |                 <el-col :span="20" style="padding: 10px;"> | 
 |  |  |                     <el-row type="flex" align="middle"> | 
 |  |  | 
 |  |  |                             <label style="font-size: 14px;">应收金额</label> | 
 |  |  |                             <label>欠款</label> | 
 |  |  |                             <label>已还</label> | 
 |  |  |                             <label>退款</label> | 
 |  |  |                             <label v-if="order.refund != 0">退款</label> | 
 |  |  |                         </el-col> | 
 |  |  |                         <el-col :span="14" style="text-align: right;"> | 
 |  |  |                             <label>¥ {{order.total}}</label> | 
 |  |  | 
 |  |  |                             <label>¥ {{order.zkTotal}}</label> | 
 |  |  |                             <label>¥ {{order.arrears}}</label> | 
 |  |  |                             <label>¥ {{order.repay}}</label> | 
 |  |  |                             <label>¥ {{order.refund}}</label> | 
 |  |  |                             <label v-if="order.refund != 0">¥ {{order.refund}}</label> | 
 |  |  |                         </el-col> | 
 |  |  |                     </el-row> | 
 |  |  |                 </el-col> | 
 |  |  | 
 |  |  |                     <el-row> | 
 |  |  |                         <el-button size="mini" type="primary" @click="openPayMoneyDialog" v-if="isRefund">提交退款</el-button> | 
 |  |  |                         <el-button size="mini" type="danger" @click="isRefund = false" v-if="isRefund">取消</el-button> | 
 |  |  |                         <el-button size="mini" type="primary" @click="isRefund = true" v-else>退款</el-button> | 
 |  |  |                         <el-button size="mini" type="primary" @click="isRefund = true" v-if="order.statu == '已付款' && !isRefund">退款</el-button> | 
 |  |  |                     </el-row> | 
 |  |  |                     <el-row v-if="!isRefund"> | 
 |  |  |                     <el-row v-show="!isRefund"> | 
 |  |  |                         <el-table | 
 |  |  |                                 :data="orderItems" | 
 |  |  |                                 style="width: 100%"> | 
 |  |  | 
 |  |  |                             </el-table-column> | 
 |  |  |                         </el-table> | 
 |  |  |                     </el-row> | 
 |  |  |                     <el-row v-if="isRefund"> | 
 |  |  |                     <el-row v-show="isRefund"> | 
 |  |  |                         <el-table | 
 |  |  |                                 :data="orderItems" | 
 |  |  |                                 style="width: 100%"> | 
 |  |  | 
 |  |  |                             </el-table-column> | 
 |  |  |                             <el-table-column label="退款单价"> | 
 |  |  |                                 <template slot-scope="scope"> | 
 |  |  |                                     <el-input v-model="scope.row.refundPrice"></el-input> | 
 |  |  |                                     <el-input v-model="scope.row.refundPrice" v-if="scope.row.count > 0"></el-input> | 
 |  |  |                                 </template> | 
 |  |  |                             </el-table-column> | 
 |  |  |                             <el-table-column label="退款数量"> | 
 |  |  |                                 <template slot-scope="scope"> | 
 |  |  |                                     <el-input v-model="scope.row.refundCount"></el-input> | 
 |  |  |                                     <el-input v-model.number="scope.row.refundCount" v-if="scope.row.count > 0"></el-input> | 
 |  |  |                                 </template> | 
 |  |  |                             </el-table-column> | 
 |  |  |                             <el-table-column label="是否退库存" align="center"> | 
 |  |  |                                 <template slot-scope="scope"> | 
 |  |  |                                     <el-checkbox v-model="scope.row.returnStore" v-if="scope.row.type == '家居产品' && scope.row.count > 0"></el-checkbox> | 
 |  |  |                                 </template> | 
 |  |  |                             </el-table-column> | 
 |  |  |                         </el-table> | 
 |  |  | 
 |  |  |                                 </el-table-column> | 
 |  |  |                                 <el-table-column label="业绩"> | 
 |  |  |                                     <template slot-scope="scope"> | 
 |  |  |                                         <el-input v-model="scope.row.returnAchieve"></el-input> | 
 |  |  |                                         <el-input v-model="scope.row.returnAchieve" v-if="scope.row.zkTotal != 0"></el-input> | 
 |  |  |                                     </template> | 
 |  |  |                                 </el-table-column> | 
 |  |  |                                 <el-table-column label="提成"> | 
 |  |  |                                     <template slot-scope="scope"> | 
 |  |  |                                         <el-input v-model="scope.row.returnCommission"></el-input> | 
 |  |  |                                         <el-input v-model="scope.row.returnCommission" v-if="scope.row.zkTotal != 0"></el-input> | 
 |  |  |                                     </template> | 
 |  |  |                                 </el-table-column> | 
 |  |  |                                 <el-table-column | 
 |  |  | 
 |  |  |                 </el-tab-pane> | 
 |  |  |                 <el-tab-pane label="业绩设置" name="second"> | 
 |  |  |                     <el-row> | 
 |  |  |                         <el-button size="mini" type="primary" @click="saveAchieve">保存</el-button> | 
 |  |  |                         <el-button size="mini" type="primary" @click="saveAchieve" v-if="order.statu == '已付款'">保存</el-button> | 
 |  |  |                     </el-row> | 
 |  |  |                     <el-table | 
 |  |  |                             :data="achieveItems" | 
 |  |  | 
 |  |  |  | 
 |  |  |         <el-row type="flex" align="middle" style="padding: 10px 0;"> | 
 |  |  |             <el-col :span="5" style="text-align: center;">退款方式</el-col> | 
 |  |  |             <el-col class="paymethod" :span="15"> | 
 |  |  |             <el-col class="paymethod" :span="18"> | 
 |  |  |                 <el-row> | 
 |  |  |                     <ul> | 
 |  |  |                         <span v-for="(item, index) in payMethods"> | 
 |  |  | 
 |  |  |                                          @check="(click, checked,$item)=>{handleCheckChange(click, checked,$item)}" | 
 |  |  |                                          :props="defaultProps"> | 
 |  |  |                                 </el-tree> | 
 |  |  |                                 <li :class="{active : item.isActive}" slot="reference" @click="payMethodSelect(item, index)">{{item.value}}</li> | 
 |  |  |                                 <li :class="{active : item.isActive}" slot="reference" @click="payMethodSelect(item, index)"><div style=" height:30px; line-height: 30px; display: flex; align-items: center"><img style="width: 25px; height: 25px; align-items: center;" :src="item.img"><span style="margin-left: 5px;">{{item.value}}</span></div></li> | 
 |  |  |                             </el-popover> | 
 |  |  |                         </span> | 
 |  |  |                     </ul> | 
 |  |  | 
 |  |  |             <el-col :span="15"> | 
 |  |  |                 <el-row style="line-height: 50px;" v-for="(item, index) in payMoneys"> | 
 |  |  |                     <el-col :span="6" style="text-align: right; padding-right: 10px; font-size: 12px;">{{item.value}}</el-col> | 
 |  |  |                     <el-col :span="8"><el-input v-model.number="item.money"></el-input></el-col> | 
 |  |  |                     <el-col :span="8"><el-input v-model="item.money"></el-input></el-col> | 
 |  |  |                     <el-col :span="6" style="margin-left: 10px;" v-if="item.type == '储值卡'">{{item.isGift == 1 ? '赠送余额' : '余额' }}:<span class="arrears">¥ {{item.balance}}</span></el-col> | 
 |  |  |                 </el-row> | 
 |  |  |             </el-col> | 
 |  |  | 
 |  |  |     var app = new Vue({ | 
 |  |  |         el : "#app", | 
 |  |  |         data : { | 
 |  |  |             orderParam : "", | 
 |  |  |             vipInfo : "", | 
 |  |  |             order : "", | 
 |  |  |             activeName : "first", | 
 |  |  | 
 |  |  |             isReturnAchieve : false, | 
 |  |  |             payMethods: [{ | 
 |  |  |                 value: '现金支付', | 
 |  |  |                 img: '/images/pay/cash.png', | 
 |  |  |                 isActive: false, | 
 |  |  |                 type: '现金支付' | 
 |  |  |             }, { | 
 |  |  |                 value: '微信', | 
 |  |  |                 img: '/images/pay/wechat.png', | 
 |  |  |                 isActive: false, | 
 |  |  |                 type: '微信' | 
 |  |  |             }, { | 
 |  |  |                 value: '支付宝', | 
 |  |  |                 img: '/images/pay/zhifubao.png', | 
 |  |  |                 isActive: false, | 
 |  |  |                 type: '支付宝' | 
 |  |  |             }, { | 
 |  |  |                 value: '银行卡', | 
 |  |  |                 img: '/images/pay/yinlian.png', | 
 |  |  |                 isActive: false, | 
 |  |  |                 type: '银行卡' | 
 |  |  |             }, { | 
 |  |  |                 value: '团购', | 
 |  |  |                 img: '/images/pay/tuan.png', | 
 |  |  |                 isActive: false, | 
 |  |  |                 type: '团购' | 
 |  |  |             }, { | 
 |  |  |                 value: '储值卡', | 
 |  |  |                 img: '/images/pay/card.png', | 
 |  |  |                 isActive: false, | 
 |  |  |                 type: '储值卡' | 
 |  |  |             }, ], | 
 |  |  | 
 |  |  |             treeSelect : [], | 
 |  |  |             payMoneys : [], | 
 |  |  |             printPaper : true, | 
 |  |  |             refundMoney : "", | 
 |  |  |             refundMoney : 0, | 
 |  |  |             data : {}, | 
 |  |  |  | 
 |  |  |         }, | 
 |  |  |         created : function() { | 
 |  |  |             let _this = this; | 
 |  |  |             this.vipInfo = /*[[${vipInfo}]]*/ | 
 |  |  |             this.order = /*[[${order}]]*/ | 
 |  |  |             this.orderItems = /*[[${orderItems}]]*/ | 
 |  |  |             this.payMethodItems = /*[[${payMethods}]]*/ | 
 |  |  |             this.achieveItems = /*[[${achieveList}]]*/ | 
 |  |  |             this.flowItems = this.order.flows; | 
 |  |  |  | 
 |  |  |             this.checkAchieveIsDel(this.achieveItems); | 
 |  |  |             this.order.orderTime = moment(this.order.orderTime).format("YYYY-MM-DD HH:mm"); | 
 |  |  |  | 
 |  |  |             var arrears = 0; | 
 |  |  |             var refund = 0; | 
 |  |  |             var repay = 0; | 
 |  |  |             for(var i = 0; i < this.flowItems.length; i++) { | 
 |  |  |                 var item = this.flowItems[i]; | 
 |  |  |                 if (item.payMethod === '欠款') { | 
 |  |  |                     arrears += item.amount; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 if (item.flowType === '还款') { | 
 |  |  |                     repay += item.amount; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 if (item.flowType === '退款') { | 
 |  |  |                     refund += item.amount; | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |             this.order.arrears = arrears; | 
 |  |  |             this.order.refund = refund; | 
 |  |  |             this.order.repay = repay; | 
 |  |  |  | 
 |  |  |             //获取用户列表 | 
 |  |  |             AjaxProxy.requst({ | 
 |  |  |                 app: _this, | 
 |  |  |                 url: basePath + '/admin/shopAll', | 
 |  |  |                 callback: function (data) { | 
 |  |  |                     _this.userList = data.rows; | 
 |  |  |                 } | 
 |  |  |             }); | 
 |  |  |             _this.getVipMoneyCards(); | 
 |  |  |             this.orderParam = /*[[${orderParam}]]*/ | 
 |  |  |             this.queryOrderDetailData(this.orderParam); | 
 |  |  |  | 
 |  |  |         }, | 
 |  |  |         methods : { | 
 |  |  |             queryOrderDetailData(param) { | 
 |  |  |                 let _this = this; | 
 |  |  |                 AjaxProxy.requst({ | 
 |  |  |                     app: _this, | 
 |  |  |                     data: {id: param, orderNo:param}, | 
 |  |  |                     contentType: 'application/x-www-form-urlencoded', | 
 |  |  |                     url: basePath + '/admin/order/findOrderDetailByIdOrNo', | 
 |  |  |                     callback: function (data) { | 
 |  |  |                         console.log(data); | 
 |  |  |                         var mapInfo = data.mapInfo; | 
 |  |  |                         _this.vipInfo = mapInfo.vipInfo; | 
 |  |  |                         _this.order = mapInfo.order; | 
 |  |  |                         _this.orderItems = mapInfo.orderItems; | 
 |  |  |                         _this.payMethodItems = mapInfo.payMethods; | 
 |  |  |                         _this.achieveItems = mapInfo.achieveList; | 
 |  |  |  | 
 |  |  |                         _this.flowItems = _this.order.flows; | 
 |  |  |  | 
 |  |  |                         _this.checkAchieveIsDel(_this.achieveItems); | 
 |  |  |                         _this.order.orderTime = moment(_this.order.orderTime).format("YYYY-MM-DD HH:mm"); | 
 |  |  |  | 
 |  |  |                         var arrears = 0; | 
 |  |  |                         var refund = 0; | 
 |  |  |                         var repay = 0; | 
 |  |  |                         for(var i = 0; i < _this.flowItems.length; i++) { | 
 |  |  |                             var item = _this.flowItems[i]; | 
 |  |  |                             if (item.payMethod === '欠款') { | 
 |  |  |                                 arrears += item.amount; | 
 |  |  |                             } | 
 |  |  |  | 
 |  |  |                             if (item.flowType === '还款') { | 
 |  |  |                                 repay += item.amount; | 
 |  |  |                             } | 
 |  |  |  | 
 |  |  |                             if (item.flowType === '退款') { | 
 |  |  |                                 refund += item.amount; | 
 |  |  |                             } | 
 |  |  |                         } | 
 |  |  |                         _this.order.arrears = arrears; | 
 |  |  |                         _this.order.refund = refund; | 
 |  |  |                         _this.order.repay = repay; | 
 |  |  |  | 
 |  |  |                         //获取用户列表 | 
 |  |  |                         AjaxProxy.requst({ | 
 |  |  |                             app: _this, | 
 |  |  |                             url: basePath + '/admin/shopAll', | 
 |  |  |                             callback: function (data) { | 
 |  |  |                                 _this.userList = data.rows; | 
 |  |  |                             } | 
 |  |  |                         }); | 
 |  |  |                         _this.getVipMoneyCards(); | 
 |  |  |                     } | 
 |  |  |                 }); | 
 |  |  |             }, | 
 |  |  |             confirmSubmit() { | 
 |  |  |                 let _this = this; | 
 |  |  |                 _this.data.oldOrderId = _this.order.id; | 
 |  |  |                 _this.data.vipId = _this.vipInfo.id; | 
 |  |  |  | 
 |  |  |                 if(!_this.payMethodFlow()) { | 
 |  |  |                     return; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 let orderItems = _this.orderItems; | 
 |  |  |                 let dataItems = []; | 
 |  |  |                 for(var i = 0; i < orderItems.length; i++) { | 
 |  |  |                     let item = orderItems[i]; | 
 |  |  |                     if (item.refundPrice && item.refundCount) { | 
 |  |  |                         let achieveList = [] | 
 |  |  |                         if (_this.isReturnAchieve) { | 
 |  |  |                             for(var j = 0; j < _this.achieveItems.length; j++) { | 
 |  |  |                                 let achieveItem = _this.achieveItems[j]; | 
 |  |  |                                 if (achieveItem.returnAchieve || achieveItem.returnCommission) { | 
 |  |  |                                     achieveItem.t1 = achieveItem.returnAchieve ?  achieveItem.returnAchieve : 0; | 
 |  |  |                                     achieveItem.projPercentage = achieveItem.returnCommission ? achieveItem.returnCommission : 0; | 
 |  |  |                                     achieveList.push(achieveItem); | 
 |  |  |                                 } | 
 |  |  |                             } | 
 |  |  |  | 
 |  |  |                             item.achaeveList = achieveList; | 
 |  |  |                         } | 
 |  |  |                         if (item.returnStore) { | 
 |  |  |                             item.isReturnStore = 'Y'; | 
 |  |  |                         } else { | 
 |  |  |                             item.isReturnStore = 'N'; | 
 |  |  |                         } | 
 |  |  |  | 
 |  |  |                         item.preCount = item.count; | 
 |  |  |                         item.count = item.refundCount; | 
 |  |  |                         item.zkPrice = item.refundPrice; | 
 |  |  |                         item.cashPay = 0; | 
 |  |  |                         item.cardPay = 0; | 
 |  |  |                         item.oldItemId = item.id; | 
 |  |  |                         dataItems.push(item); | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 _this.data.items = dataItems; | 
 |  |  |                 AjaxProxy.requst({ | 
 |  |  |                     app: _this, | 
 |  |  |                     data: _this.data, | 
 |  |  |                     contentType: 'application/json', | 
 |  |  |                     url: basePath + '/admin/order/refundOrder', | 
 |  |  |                     callback: function (data) { | 
 |  |  |                         _this.isRefund = false; | 
 |  |  |                         _this.dialogSettleVisible = false; | 
 |  |  |                         _this.queryOrderDetailData(_this.data.oldOrderId); | 
 |  |  |                     } | 
 |  |  |                 }); | 
 |  |  |  | 
 |  |  |             }, | 
 |  |  |             payMethodFlow() { | 
 |  |  |                 let _this = this; | 
 |  |  |                 if (_this.payMoneys.length > 0) { | 
 |  |  |                     let flows = [] | 
 |  |  |                     var total = 0; | 
 |  |  |                     _this.payMoneys.forEach(item => { | 
 |  |  |                         let flow = {}; | 
 |  |  |                         flow.payMethod = item.type; | 
 |  |  |                         if (!item.money) { | 
 |  |  |                             this.$message.warning("请输入" + item.type + "的付款金额"); | 
 |  |  |                             return false; | 
 |  |  |                         } | 
 |  |  |                         flow.amount = parseFloat(item.money); | 
 |  |  |                         if (item.type == '储值卡'){ | 
 |  |  |                             flow.isGift = item.isGift; | 
 |  |  |                             flow.cardId = item.id; | 
 |  |  |                         } | 
 |  |  |                         total += parseFloat(item.money); | 
 |  |  |                         flows.push(flow) | 
 |  |  |                     }) | 
 |  |  |                     if (total != _this.refundMoney) { | 
 |  |  |                         this.$message.warning("输入付款总金额与应付金额不符"); | 
 |  |  |                         return false; | 
 |  |  |                     } | 
 |  |  |                     _this.data.flows = flows; | 
 |  |  |                     return true; | 
 |  |  |                 } else { | 
 |  |  |                     this.$message.warning("请选择支付方式"); | 
 |  |  |                     return false; | 
 |  |  |                 } | 
 |  |  |             }, | 
 |  |  |             openPayMoneyDialog() { | 
 |  |  |                 let _this = this; | 
 |  |  |                 let items = this.orderItems; | 
 |  |  |                 _this.refundMoney = 0; | 
 |  |  |  | 
 |  |  |                 for(var i = 0; i < items.length; i++) { | 
 |  |  |                     let item = items[i] | 
 |  |  |                     if (item.refundPrice && item.refundCount) { | 
 |  |  |                         _this.refundMoney += (item.refundPrice * item.refundCount); | 
 |  |  |                     } else { | 
 |  |  |                         if (item.refundCount > item.count) { | 
 |  |  |  | 
 |  |  |                         if (!item.refundPrice > 0 && !item.refundCount > 0) { | 
 |  |  |                             _this.$message.error("退款金额或退款数量须大于0"); | 
 |  |  |                             return; | 
 |  |  |                         } | 
 |  |  |  | 
 |  |  |                         _this.$message.error("退款单价或退款数量不能为空"); | 
 |  |  |                         return; | 
 |  |  |                         if (item.refundCount > item.count) { | 
 |  |  |                             _this.$message.error("输入正确的退款数量"); | 
 |  |  |                             return; | 
 |  |  |                         } | 
 |  |  |  | 
 |  |  |                         _this.refundMoney += parseFloat(item.refundPrice * item.refundCount); | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 if (_this.refundMoney == 0) { | 
 |  |  |                     _this.$message.error("请输入退款金额或退款数量"); | 
 |  |  |                     return; | 
 |  |  |                 } | 
 |  |  |                 _this.dialogSettleVisible = true; | 
 |  |  |             }, | 
 |  |  |             calOrderTotalFormatter(row, column) { | 
 |  |  |                 return row.count * row.price; | 
 |  |  | 
 |  |  |                             } | 
 |  |  |                         } else { | 
 |  |  |                             Vue.set(item,'isActive',true); | 
 |  |  |                             var hasAmount = 0; | 
 |  |  |                             for(var i = 0; i < payMoneys.length; i++) { | 
 |  |  |                                 hasAmount += parseFloat(payMoneys[i].money); | 
 |  |  |                             } | 
 |  |  |                             if (_this.refundMoney - hasAmount > 0) { | 
 |  |  |                                 Vue.set(item, 'money', _this.refundMoney - hasAmount); | 
 |  |  |                             } | 
 |  |  |                             _this.payMoneys.push(item); | 
 |  |  |                         } | 
 |  |  |                     }); | 
 |  |  | 
 |  |  |             }, | 
 |  |  |             closeFrame() { | 
 |  |  |                 parent.layer.close(parent.layer.getFrameIndex(window.name)); | 
 |  |  |             }, | 
 |  |  |             confirmSubmit() { | 
 |  |  |  | 
 |  |  |             }, | 
 |  |  |             saveAchieve() { | 
 |  |  |                 let _this = this; |