refundDetial.vue 10.3 KB
Newer Older
lixiaomin committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
<template>
  <div class="app-container">
    <!-- 详情对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body>
      <el-tabs v-model="activeName" @tab-click="handleClick">
        <el-tab-pane label="订单信息" name="first">
          <el-form ref="form" :model="form" label-width="80px">
            <el-row>
              <el-col :span="8">
                <el-form-item label="订单编号" >
                  <el-input v-model="form.orderNo" disabled/>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="顺序号" >
                  <el-input v-model="form.orderNum" disabled/>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="订单状态" >
                  <el-input v-model="form.state" disabled/>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="8">
                <el-form-item label="城市" >
                  <el-input v-model="form.city" disabled/>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="店铺" >
                  <el-input v-model="form.shopName" disabled/>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="创建时间" >
                  <el-input v-model="form.createdAt" disabled/>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="8">
                <el-form-item label="商品数量" >
                  <el-input v-model="form.goodsNum" disabled/>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="金额" >
lixiaomin committed
50
                  <el-input v-model="form.paidAmount" disabled/>
lixiaomin committed
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="付款时间" >
                  <el-input v-model="form.payTime" disabled/>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="8">
                <el-form-item label="用户昵称" >
                  <el-input v-model="form.userName" disabled/>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="用户电话" >
                  <el-input disabled/>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="完成时间" >
                  <el-input v-model="form.finishTime" disabled/>
                </el-form-item>
              </el-col>
            </el-row>           
            <el-table :data="goodsList">
              <el-table-column label="商品名称" align="center" prop="goodsName" />
              <el-table-column label="缩略图" align="center">
                <template slot-scope="scope">              
                  <div class="image-tmp">
                    <el-image style="width: 100px; height: 100px"  :src="getPicsList(scope.row.pics)" :preview-src-list="getPicsBigList(scope.row.pics)">
                      <div slot="error" class="image-slot"></div>            
                    </el-image>
                  </div>    
                </template>
              </el-table-column>
              <el-table-column label="商品分类" align="center" prop="categoryName" />
lixiaomin committed
88 89
              <el-table-column label="原售价" align="center" prop="oriAmount" />
              <el-table-column label="折扣价" align="center" prop="amountShould" />
lixiaomin committed
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
              <el-table-column label="实付" align="center" prop="realAmount" />
              <el-table-column label="数量" align="center" prop="num" />              
            </el-table> 
            <div style="margin-top: 20px;">
              <div style="font-weight:bold;font-size: larger;">
                <span>退款信息</span>
              </div>
              <el-form-item label="退款状态" >
                <el-input  v-model="form.refundState" style="width:200px;" disabled/>
              </el-form-item>
              <el-form-item label="退款金额" >
                <el-input  v-model="form.refundAmount" style="width:200px;" disabled/>
              </el-form-item>
              <el-form-item label="处理备注" >
                <el-input  v-model="form.desc" type="textarea" disabled/>
              </el-form-item>
            </div>            
          </el-form>
        </el-tab-pane>
        <el-tab-pane label="订单日志" name="second">
          <el-table  :data="logList">
            <el-table-column label="状态" align="center" prop="status" />              
            <el-table-column label="操作" align="center" prop="operation" />
            <el-table-column label="时间" align="center" prop="createAt" />
            <el-table-column label="操作人" align="center" prop="operationUser" />
            <el-table-column label="内容" align="center" prop="content" />        
            </el-table>
        </el-tab-pane>
      </el-tabs>      
      <div slot="footer" class="dialog-footer" style="text-align: center;">
        <el-button type="primary" @click="submitForm">确定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { getLogList } from "@/api/system/order";
import { getDetial } from "@/api/system/refund";
import piovince from '@/utils/piovince';
export default {
  name: "RefundDetial",  
  data() {
    return {
      piovince,
      // 总条数
      total: 0,
      // 订单表格数据
      refundList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,     
      shopName: null,    
      goodsList:[],
      // 表单参数
      form: {},
      refundId: null,     
      activeName:"first",
      logList: []      
    };
  },
  created() {
   
  },
  methods: {
    getProvince(province){
      let list=this.piovince;
      for(let i=0;i<list.length;i++){
lixiaomin committed
160 161 162 163 164 165 166 167
        if(list[i].children.length>0){
          let childrenList=list[i].children;
          for(let j=0;j<childrenList.length;j++){
            if(childrenList[j].value == province){
              return childrenList[j].name;
            } 
          }
        }       
lixiaomin committed
168 169 170 171 172 173 174 175 176 177 178 179 180
      }
    },
    // 取消按钮
    cancel() {
      this.activeName="first";
      this.open = false;    
    },
    /** 提交按钮 */
    submitForm() {
      this.open=false;
      this.activeName="first"     
    },
    formatterState(state){
lixiaomin committed
181 182
       if(state == 0){
        return "创建未校验(创建未校验)";
lixiaomin committed
183
      }else if(state == 1){
lixiaomin committed
184
        return "未支付(待付款)";
lixiaomin committed
185
      }else if(state == 2){
lixiaomin committed
186
        return "已支付(待制作)";
lixiaomin committed
187
      }else if(state == 3){
lixiaomin committed
188
        return "支付制作中(制作中)";
lixiaomin committed
189
      }else if(state == 4){
lixiaomin committed
190
        return "制作完成未取(待取餐)";
lixiaomin committed
191
      }else if(state == 5){
lixiaomin committed
192
        return "取餐中(取餐中)";
lixiaomin committed
193
      }else if(state == 6){
lixiaomin committed
194
        return "正常完成(已完成)";
lixiaomin committed
195
      }else if(state == 7){
lixiaomin committed
196
       return "待取超时(已完成)";
lixiaomin committed
197
      }else if(state == 8){
lixiaomin committed
198
       return "未支付取消(已取消)";
lixiaomin committed
199
      }else if(state == 9){
lixiaomin committed
200
        return "支付后制作前取消(已取消)";
lixiaomin committed
201
      }else if(state == 10){
lixiaomin committed
202
        return "制作中取消(已取消)";        
lixiaomin committed
203
      }else if(state == 11){
lixiaomin committed
204
        return "制作完成取消(已取消)";  
lixiaomin committed
205
      }else if(state == 12){
lixiaomin committed
206
        return "退款中(退款中)";  
lixiaomin committed
207
      }else if(state == 13){
lixiaomin committed
208
        return "退款失败(退款失败)";  
lixiaomin committed
209
      }else if(state == 14){
lixiaomin committed
210
        return "部分退款(部分退款)";  
lixiaomin committed
211
      }else if(state == 15){
lixiaomin committed
212
        return "已退款(已退款)";  
lixiaomin committed
213
      }else if(state == 50){
lixiaomin committed
214
        return "其他人工干预状态(其他人工干预状态)";  
lixiaomin committed
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248
      }
    },
    handleClick(tab) {
      if(tab.name=="first"){
        this.getRefundDetail(this.refundId);
      }else if(tab.name=="second"){
        this.getLogList();
      }
    },
    /** 查询订单日志列表 */
    getLogList() {
      //this.loading = true;
      getLogList({orderId:this.orderId}).then(response => {
        if(response.code=="200"){
          this.logList = response.data; 
        }
      });
    },

    /** 详情按钮操作 */
    getDetial(row) {
      this.goodsList=[];
      this.orderId= row.orderId; 
      this.refundId=row.id;
      this.title="退款信息";
      this.open = true;
      this.getRefundDetail(this.refundId);
    },
    getRefundDetail(id){
      getDetial(id).then(response => {
        if(response.code=="200"){
          this.goodsList=[];
          this.form = response.data.order;
          this.form.refundAmount=response.data.refundAmount;
lixiaomin committed
249 250 251 252 253 254 255 256 257 258 259
          this.form.remark=response.data.remark;
          this.form.refundState=response.data.state;
          if(response.data.state!=""){
            if(response.data.state=="1"){
              this.form.refundState="退款中"
            }else if(response.data.state=="2"){
              this.form.refundState="退款成功"
            }else if(response.data.state=="3"){
              this.form.refundState="退款失败 "
            }
          }
lixiaomin committed
260 261 262 263 264 265 266
          this.form.shopName=response.data.order.shop.name;
          this.form.state=this.formatterState(response.data.order.state);  
          this.form.city=this.getProvince(response.data.order.shop.city);        
          if(response.data.order.orderDetails.length>0){
            let list=response.data.order.orderDetails;
            for(let i=0;i<list.length;i++){
             this.goodsList.push({"goodsName":list[i].goods.name,"pics":list[i].goods.pics,
lixiaomin committed
267
             "categoryName":list[i].goods.categoryName,"oriAmount":list[i].oriAmount,"amountShould":list[i].amountShould,
lixiaomin committed
268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286
             "realAmount":list[i].realAmount,"num":list[i].num})
            }
          }
        }        
      });
    },
    getPicsList(str){   
      let picObj = JSON.parse(str);  
      return picObj.thumbnail
    },
    getPicsBigList(str){
      let list=[];
      let picObj = JSON.parse(str);  
      list.push(picObj.thumbnail)
      return list;
    },    
  }
};
</script>