MrShi
2 天以前 4eac422e52a4d28fb651b75d0f054697c7a2c0fa
admin/src/components/business/OperaOrderRefundWindow.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,277 @@
<template>
  <GlobalWindow
      :title="title"
      width="100%"
      :visible.sync="visible"
  >
    <div class="detail-box"  >
      <p class="tip-warn" style="margin-bottom: 30px;font-size: 14px;">
        <i class="el-icon-warning"></i>
        æ“ä½œè¯´æ˜Žï¼šæ‚¨æ­£é’ˆå¯¹è®¢å•<span class="red">{{ info.code }} </span>进行退款操作,该操作不可逆请谨慎操作!!</p>
      <div class="header">
        <div  class="header-b">商品信息</div>
      </div>
      <div class="info-item"  >
        <el-table  :data="info.goodsorderDetailList||[]"  stripe  border >
          <el-table-column prop="imgurl" label="商品图" min-width="80px" align="center">
            <template slot-scope="{row}">
              <el-image style="width: 50px;height: 50px;" v-if="row.imgurl && row.imgurl!=''" :src="row.imgurl" :preview-src-list="[row.imgurl]"></el-image>
            </template>
          </el-table-column>
          <el-table-column prop="name" label="商品名称"   align="center" min-width="150px">  </el-table-column>
          <el-table-column prop="categoryName" label="商品分类"   align="center" min-width="150px">  </el-table-column>
          <el-table-column prop="goodsWeight" label="重量(kg)" align="center" min-width="150px"></el-table-column>
          <el-table-column prop="price" label="销售价(元)" align="center" min-width="100px">
            <template slot-scope="{row}">
              <span>ï¿¥{{(row.price || 0).toFixed(2)}}</span>
            </template>
          </el-table-column>
          <el-table-column prop="goodsNum" label="数量" align="center" min-width="150px"></el-table-column>
          <el-table-column prop="totalPrice" label="小计(元)" align="center" min-width="150px">
            <template slot-scope="{row}">
              <span class="orange">ï¿¥{{(row.totalPrice || 0).toFixed(2)}}</span>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <div class="info-item"  >
        <div class="info-item-a">商品总价:<span> ï¿¥{{((info.totalPrice||0)-(info.mailPrice || 0)).toFixed(2)}}</span></div>
        <div class="info-item-a">快递费:<span>ï¿¥{{(info.mailPrice||0).toFixed(2)}}</span></div>
        <div class="info-item-a">订单总价:<span> ï¿¥{{(info.totalPrice||0).toFixed(2)}}</span></div>
      </div>
      <div class="info-item"  >
        <div class="info-item-a">积分抵扣:<span v-if="(info.integral||0)>0">-ï¿¥{{(info.integral||0).toFixed(2) +'  '}}使用{{(info.useIntegral||0)}}积分抵扣¥{{(info.integral||0).toFixed(2) +'  '}}元</span></div>
        <div class="info-item-a">优惠券:<span v-if="(info.couponPrice||0)>0">-ï¿¥{{(info.couponPrice||0).toFixed(2) +'  '}} ä½¿ç”¨{{info.couponName}}</span></div>
        <div class="info-item-a">经销商结算:<span style="margin-right: 10px;"> ï¿¥{{(info.shopSettlement||0).toFixed(2)}}</span>({{info.shopName}})</div>
      </div>
      <div class="info-item"  >
        <div class="info-item-a">实付金额:<span class="red"> ï¿¥{{(info.price||0).toFixed(2)}}</span></div>
        <div class="info-item-a">返还用户积分:<span class="orange"> {{(info.returnMemberIntegral||0)}}</span></div>
        <div class="info-item-a">返还经销商积分:<span class="orange">ï¿¥{{(info.shopSettlement || 0).toFixed(2) }}</span></div>
      </div>
      <div class="header">
        <div  class="header-b">退款内容</div>
        <div class="info-item"  >
          <el-form :model="form" ref="form" label-width="120px" label-suffix=":"  :rules="rules" inline>
            <el-form-item label="退款金额" prop="money" style="display: block;">
              <el-input type="number"  v-model="form.money" placeholder="请输入退款金额" v-trim>  <template slot="append"> å…ƒ</template>  </el-input>
              <span class="tip-warn" style="margin-bottom: 30px;font-size: 14px;">   <i class="el-icon-warning"></i>
              æç¤ºï¼šå½“前订单最多可退金额为<span class="red">{{(info.price||0).toFixed(2)}}</span></span>
            </el-form-item>
            <div style="display:flex;">
              <el-form-item label="退还" prop="refundInfo"  style="display: inline;">
                <el-checkbox style="border: none;" v-model="form.returnUseCouponStatus" label="退还客户优惠券" border></el-checkbox>
              </el-form-item>
              <el-form-item label="" prop="refundInfo"  style="display: inline;">
                <el-checkbox style="border: none"  v-model="form.returnUseIntegralStatus" label="退还客户积分" border></el-checkbox>
              </el-form-item>
            </div>
            <div style="display:flex;">
              <el-form-item label="扣除" prop="refundInfo"  style="display: inline;">
                <el-checkbox style="border: none"  v-model="form.returnShopSettlementStatus" label="扣除经销商已结算金额" border></el-checkbox>
              </el-form-item>
              <el-form-item label="" prop="refundInfo"  style="display: inline;">
                <el-checkbox style="border: none"  v-model="form.returnIntegralStatus" label="扣除已返客户积分" border></el-checkbox>
              </el-form-item>
              <el-form-item label="" prop="refundInfo"  style="display: inline;">
                <el-checkbox style="border: none"  v-model="form.returnShopIntegralStatus" label="扣除已返经销商积分" border></el-checkbox>
              </el-form-item>
            </div>
            <el-form-item label="备注" prop="remark"  style="display: block;">
              <el-input type="textarea" :autosize="{ minRows: 4, maxRows:4 }" style="width: 500px;" v-model="form.remark" placeholder="请输入取消说明"  v-trim/>
            </el-form-item>
          </el-form>
        </div>
      </div>
    </div>
    <template  v-slot:footer>
      <el-button type="primary" @click="confirm">确认</el-button>
      <el-button @click="visible=false">返回</el-button>
    </template>
  </GlobalWindow>
</template>
<script>
import GlobalWindow from '@/components/common/GlobalWindow'
import BaseOpera from '@/components/base/BaseOpera'
import { shopDetail } from '@/api/business/shop'
export default {
  name: 'OperaOrderRefundWindow',
  extends: BaseOpera,
  components: { GlobalWindow },
  data () {
    return {
      title: '',
      visible2: false,
      visible: false,
      tabelHeight: null,
      info: {},
      shopInfo: {},
      rules: {
        money: [
          { required: true, message: '请输入退款金额', tigger: 'blur' }
        ]
      },
      // æœç´¢
      form: {
        orderId: '',
        money: null,
        returnShopIntegralStatus: false,
        returnIntegralStatus: false,
        returnShopSettlementStatus: false,
        returnUseIntegralStatus: false,
        returnUseCouponStatus: false,
        remark: ''
      }
    }
  },
  created () {
    this.config({
      module: '订单信息表',
      api: '/business/goodsorder',
      'field.id': 'id',
      'field.main': 'id'
    })
  },
  methods: {
    successBiz () {
      this.loadInfo()
      this.$emit('success')
    },
    loadInfo () {
      shopDetail(this.info.distributionShopId).then(res => {
        this.shopInfo = res || this.shopInfo
      })
    },
    open (title, info) {
      this.title = title
      this.visible = true
      this.info = info || {}
      this.form = {
        orderId: info.id,
        money: null,
        returnShopIntegralStatus: false,
        returnIntegralStatus: false,
        returnShopSettlementStatus: false,
        returnUseIntegralStatus: false,
        returnUseCouponStatus: false,
        remark: ''
      }
      if (this.info.distributionShopId != null) {
        this.loadInfo()
      }
    },
    doSubmit () {
    },
    confirm () {
      this.$refs.form.validate((valid) => {
        if (!valid) {
          return
        }
        var msg = `确定对订单【${this.info.code}】进行退款操作吗?`
        if (this.form.returnShopSettlementStatus && (this.info.shopSettlement || 0) > 0 && (this.info.shopSettlement || 0) > (this.shopInfo.amount || 0)) {
          msg = '经销商余额不足,' + msg
        }
        this.$dialog.messageWaring(msg)
          .then(() => {
            this.isWorking = true
            this.api.orderRefund({
              orderId: this.form.orderId,
              money: this.form.money,
              returnShopIntegralStatus: this.form.returnShopIntegralStatus ? 1 : 0,
              returnIntegralStatus: this.form.returnIntegralStatus ? 1 : 0,
              returnShopSettlementStatus: this.form.returnShopSettlementStatus ? 1 : 0,
              returnUseIntegralStatus: this.form.returnUseIntegralStatus ? 1 : 0,
              returnUseCouponStatus: this.form.returnUseCouponStatus ? 1 : 0,
              remark: this.form.remark
            })
              .then(() => {
                this.visible = false
                this.$tip.apiSuccess('退款成功')
                this.$emit('success')
              }).catch(e => {
                this.$tip.apiFailed(e)
              })
              .finally(() => {
                this.isWorking = false
              })
          })
        // è°ƒç”¨æ–°å»ºæŽ¥å£
      })
    }
  }
}
</script>
<style scoped  lang="scss">
.table-pagination{
  position: fixed !important;
  bottom: 50px;
}
.header-b{
  display: inline-block;
  font-size: 16px;
  font-weight: bold;
}
.header-red-btn{
  display: inline-block;
  font-size: 12px;
  background-color:  red;
  padding: 2px 10px 3px 10px;
  margin-left: 20px;
  color: white;
  cursor: pointer;
  border-radius: 5px ;
}
.header-blue-btn{
  display: inline-block;
  font-size: 12px;
  background-color:  #216EEE;
  padding: 2px 10px 3px 10px;
  margin-left: 20px;
  color: white;
  cursor: pointer;
  border-radius: 5px ;
}
.header-grey{
  display: inline-block;
  font-size: 12px;
  border: 1px solid grey;
  padding: 2px 10px;
  margin-left: 20px;
  color: grey;
  border-radius: 5px ;
}
.header-orange{
  display: inline-block;
  font-size: 12px;
  border: 1px solid orange;
  padding: 2px 10px;
  margin-left: 20px;
  color: orange;
  border-radius: 5px ;
}
.header-btn{
  display: inline-block;
  border: none;
  padding: 2px 10px;
  margin-left: 20px;
}
.info-item{
  display: flex;
  width: 100%;
  margin: 15px;
}
.info-item-a{
  flex: 1;
  font-size: 14px;
}
.info-item-a span{
}
.info-item-a  .btn{
  font-size: 12px !important;
  cursor: pointer !important;
}
</style>