| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894 |
- <template>
- <view v-if="isShowPage">
- <!--mine/applyRefund/applyRefund.wxml-->
- <!-- 退货商品 -->
- <view class="shouhou txt99">选择售后商品</view>
- <!-- && orderType != 11 -->
- <view class="list3_1" v-if="deliverListss.length > 0 && multiple == 1">
- <view class="list3_2" v-for="(items, indx) in deliverListss" :key="indx">
- <!-- <view class="shouhou txt99">{{ items.supplierName ? items.supplierName : merchantName + '自营' }}</view> -->
- <!-- <view class="shouhou txt99">{{ merchantName}}</view> -->
- <block v-for="(item, idx) in items.extendDTOList" :key="idx">
- <view class="li">
- <view class="checkbox" :data-store="item.store" @tap="checkProduct(indx, idx)">
- <image :src="item.isActive ? '/static/pages/images/gou_h.png' : '/static/pages/images/gou.png'" class="check"></image>
- </view>
- <view class="info dflex flex">
- <view class="cimgs" :data-id="item.productId" @tap="checkProduct(indx, idx)">
- <image :src="item.pic + '?x-oss-process=style/w160'" class="cimg"></image>
- <image src="/static/pages/images/jishida.png" class="type" v-if="item.isJs"></image>
- </view>
- <view class="zhinfo">
- <view :class="'zhtit ' + (item.store <= 0 || item.isInvalid ? 'color999' : '')" :data-id="item.productId">{{ item.productName }}</view>
- <view v-if="item.specs && item.specs != 'DEFAULT_SKU'" class="guigecontent">
- 规格:
- <text v-for="(itemGuige, index2) in JSON.parse(item.specs)" :key="index2" class="guige" decode="true">{{ itemGuige.value }} </text>
- </view>
- <view class="jiage">
- <view class="zhjia" :data-id="item.productId" v-if="!integralshop">
- <text>¥</text>
- {{ item.money }}
- </view>
- <view class="integral" v-if="integralshop">
- <text class="intnum">{{ item.integral }}积分</text>
- <text class="money">+¥{{ item.money }}</text>
- </view>
- <block v-if="item.shouldQuantity - item.refundStock > 1">
- <view class="num">
- <view class="jian" @tap="jianQuantity(indx, idx)">-</view>
- <input class="nums" :value="item.refundQuantity" type="number" @input="getNum" @blur="minNum" :data-index="indx" :data-idx="idx" />
- <view class="jian" @tap="jiaQuantity(indx, idx)">+</view>
- </view>
- </block>
- <block v-else>
- <view class="">×{{ item.shouldQuantity }}</view>
- </block>
- </view>
- <view class="tabe dflex">
- <text>可退数量:{{ item.shouldQuantity - item.refundStock }}</text>
- <text v-if="item.refundStock">已退数量:{{ item.refundStock }}</text>
- </view>
- </view>
- </view>
- </view>
- </block>
- </view>
- <view class="all" data-index="-1" @tap="checkProduct(-1, -1)" v-if="showAll">
- <image :src="isAll ? '/static/pages/images/gou_h.png' : '/static/pages/images/gou.png'" class="check"></image>
- 全选
- </view>
- </view>
- <!-- 退款并退货 退款原因-->
- <view class="list1">
- <view class="dpname bt1" v-if="isrefund == 2 && refundMethod != 5" @tap="getRefund" data-isrefund="3">
- <view class="txt99">货物状态</view>
- <view class="fne">
- <text>{{ start ? start : '请选择' }}</text>
- <image src="/static/pages/images/more.png" class="right"></image>
- </view>
- </view>
- <view class="dpname" @tap="getRefund" data-isrefund="1" v-if="refundMethod != 5">
- <view class="txt99">退款原因</view>
- <view class="fne">
- <text>{{ refund ? refund : '请选择' }}</text>
- <image src="/static/pages/images/more.png" class="right"></image>
- </view>
- </view>
- </view>
- <!-- 退款无需退货 商品列表-->
- <!-- <view class="list">
- <view class="li" wx:for="{{products}}" wx:key="item" bindtap="toDetail" data-id="{{item.id}}">
- <view class="cimgs">
- <image src="{{item.pic}}" mode="aspectFit" class="cimg"></image>
- <image src="/pages/images/jishida.png" mode="aspectFit" class="type" wx:if="{{orderType == 5}}"></image>
- <image src="/pages/images/tuangou.png" mode="aspectFit" class="type" wx:if="{{orderType == 2}}"></image>
- </view>
- <view class="zhinfo">
- <view class="zhtit">{{item.title}}</view>
- <view wx:if="{{item.propertiesList}}" class="guigecontent">规格:
- <text wx:for="{{item.propertiesList}}" wx:for-item="itemGuige" class="guige" decode="{{true}}">{{itemGuige.value}}
- </text>
- </view>
- <view class="jiage">
- <view class="zhjia"><text class="money">¥</text><text class="size">{{item.salePrice}}</text></view>
- <view class="num">×{{item.quantity}}</view>
- </view>
- </view>
- </view>
- </view> -->
- <!-- 退款并退货 退货列表-->
- <!-- <view class="cart">
- <view class="dian1 dflex">
- <view class="flex">选择退货商品</view>
- </view>
- <view class="list1">
- <block wx:for="{{products}}" wx:key="index">
- <view class="li">
- <view class="checkbox" data-index="{{0}}" data-idx="{{index}}" bindtap="checkProduct">
- <image src="{{item.isActive ? '/pages/images/gou_h.png' : '/pages/images/gou.png'}}" class="check"></image>
- </view>
- <view class="info dflex flex">
- <view class="cimgs" bindtap="toDetail" data-id="{{item.productId}}">
- <image src="{{item.pic}}" mode="aspectFit" class="cimg"></image>
- </view>
- <view class="zhinfo">
- <view class="zhtit" bindtap="toDetail" data-id="{{item.productId}}">{{item.title}}</view>
- <view class="jiagecont">
- <text class="money">¥</text><text class="size">88.00</text>
- </view>
- <view class="jiage">
- <view class="zhjia" bindtap="" data-id="">购买数量:1</view>
- <view class="num">
- <view class="jian" bindtap="" data-index="{{0}}" data-idx="{{index}}">-</view>
- <text class="nums">{{item.quantity}}</text>
- <view class="jian" bindtap="" data-index="{{0}}" data-idx="{{index}}">+</view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </block>
- <view class="dian dflex">
- <image src="{{isJsdAll ? '/pages/images/gou_h.png' : '/pages/images/gou.png'}}" class="check" data-index="-2" bindtap="checkProduct"></image>
- <view class="flex">全选</view>
- </view>
- </view>
- </view> -->
- <!-- 退款无需退货 退款原因-->
- <!-- 换货 换货原因-->
- <!-- <view class="list1">
- <view class="dpname">
- <view>换货原因</view>
- <view class="fne">
- <text>请选择</text>
- <image src="/pages/images/more.png" class="right"></image>
- </view>
- </view>
- </view> -->
- <!-- 退款金额 -->
- <view class="list1">
- <view :class="'dpname2 dflex ' + (isrefund == 1 ? '' : bt1)" v-if="refundMethod != 5">
- <view class="txt99">退款金额:</view>
- <view>
- <text class="money">¥</text>
- <text class="size">{{ allMoney ? allMoney : '0' }}</text>
- </view>
- </view>
- <!-- <view class="dpname2 dflex {{isrefund==1?'':bt1}}" wx:if="{{refundMethod!=5&&balancePayMoney>0}}">
- <view class="txt99">退款余额:</view>
- <view><text class="money">¥</text><text class="size">{{balancePayMoney}}</text></view>
- </view> -->
- <view :class="'dpname2 dflex ' + (isrefund == 1 ? '' : bt1)" v-if="refundMethod != 5 && orderType == 11">
- <view class="txt99">退款积分:</view>
- <view>
- <text class="money"></text>
- <text class="size">{{ integral }}</text>
- </view>
- </view>
- <view class="dpname" v-if="isrefund == 2" @tap="getRefund" data-isrefund="2">
- <view class="txt99">退货方式</view>
- <view class="fne">
- <text>{{ huo ? huo : '请选择' }}</text>
- <image src="/static/pages/images/more.png" class="right"></image>
- </view>
- </view>
- </view>
- <!-- 退款并退货 退货方式 -->
- <!-- <view class="list1">
- <view class="dpname">
- <view>退货方式</view>
- <view class="fne">
- <text>请选择</text>
- <image src="/pages/images/more.png" class="right"></image>
- </view>
- </view>
- <view class="dpname3">
- <view>收货地址</view>
- <view class="addcont">
- <text>通小御 </text>
- <text>12568595625</text>
- </view>
- <view class="fne">
- <image src="/pages/images/more.png" class="bist"></image>
- </view>
- </view>
- <view class="address">
- <text>湖南省长沙市岳麓区湖南省长沙市岳麓区</text>
- <view>湖南省长沙市岳麓区湖南省长沙市</view>
- </view>
- </view> -->
- <!--退款说明 -->
- <view class="list2" v-if="refundMethod != 5">
- <view class="dpname dflex">
- <view class="sm txt99">退款说明:</view>
- <view class="dflex shouming">
- <input type="text" @input="getShuoming" placeholder="选填" />
- <image src="/mine/static/mine/images/bi.png"></image>
- </view>
- </view>
- <!-- 上传凭证 -->
- <view class="li1"><view class="txt99">上传凭证</view></view>
- <view class="dflex">
- <view v-for="(item, index) in credentialsUrl" :key="index" class="pz">
- <image :src="credentialsUrl[index]" mode="aspectFill" class="scpz"></image>
- <image src="/mine/static/mine/images/imagecuo.png" class="cuo" @tap="cleanimage" :data-index="index"></image>
- </view>
- <image src="/mine/static/mine/images/scpz.png" class="scpz" @tap="uploadAvatar" v-if="credentialsUrl.length < 3"></image>
- </view>
- </view>
- <view class="r-des">
- <rich-text v-if="refundExplainDesc" :nodes="refundExplainDesc"></rich-text>
- </view>
- <!-- 提交申请 -->
- <view class="btn-bot ddflex">
- <contact-button img-url="../../static/pages/images/kfico1.png" class-name="r-contact" button-text="客服"></contact-button>
- <view class="btn fflex" @tap="save" v-if="refundMethod != 5">提交申请</view>
- <view :class="'btn fflex ' + (refundMethod == 5 ? 'refund' : '')" v-if="refundMethod == 5" @tap="upData">提交</view>
- </view>
- <block v-if="isShow"><refund-popup :refund-type="type" @hidePopup="hidePopup" @getValue="getValue" @getIndex="getIndex" :isrefund="isrefund"></refund-popup></block>
- </view>
- </template>
- <script>
- // mine/applyRefund/applyRefund.js
- const app = getApp();
- const req = require('../../../utils/request.js');
- const util = require('../../../utils/util.js');
- const requsetmessage = require('../../../utils/requestmessage.js');
- import refundPopup from '../../../components/refund-popup/index';
- // state : 1 未付款 2 待确认 3 待发货 4 待提货 5 配送中 6 已签收 7 订单完成
- // 8 订单取消 9 退货中 10 完成退货 11 支付失败 15 进行中
- // 售后状态
- // 30 售后待审核 32 售后审核失败 35 商品待退回 36 商品退回中
- // 39 退款申请 40 退款待支付 41 退款中 42 退款失败
- // 43 退款成功
- // 处方订单
- // 20 未开方 21 开方中 22 开方失败 25 待审方
- // 26 审方中 27 审方失败,
- // 49 用户取消售后
- export default {
- data() {
- return {
- isShowPage: false,
- ids: '',
- pageList: [],
- count: 0,
- money: 0,
- isShow: true,
- credentialsUrl: [],
- id: '',
- isrefund: '',
- refundMethod: '',
- allMoney: '',
- type: '',
- refund: '',
- huo: '',
- start: '',
- refundIndex: '',
- huoIndex: '',
- startIndex: '',
- shuoming: '',
- isAll: false,
- products: [],
- list: [],
- multiple: '0',
- deliverListss: '',
- refundExplainDesc: '',
- showAll: false
- };
- },
- components: {
- refundPopup
- },
- props: {},
- /**
- * 生命周期函数--监听页面加载
- * options.isrefund=1为退款
- * options.isrefund=2为退货
- */
- onLoad: function(options) {
- // console.log(options);
- this.setData({
- id: options.id,
- isrefund: options.isrefund,
- refundMethod: options.refundMethod
- });
- if (req.getStorage('configRes')) {
- let about = JSON.parse(req.getStorage('configRes'));
- if (!about.is_open_multiple_refund) {
- this.multiple = '0';
- } else {
- this.multiple = about.is_open_multiple_refund;
- }
- // console.log(this.multiple, "about")
- }
- this.refundMethod = options.refundMethod;
- let title = '';
- if (options.isrefund == 2) {
- title = '我要退货';
- } else {
- title = '我要退款';
- }
- uni.setNavigationBarTitle({
- title: title
- });
- this.setData({
- isShow: false
- });
- if (this.refundMethod == 5) {
- this.isShowPage = true;
- }
- this.getRefundExplain();
- if (this.refundMethod != 5) {
- this.getOrderDet();
- }
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function() {
-
- },
- methods: {
- getRefundExplain() {
- req.getRequest(
- '/api/params/value',
- {
- type: 'refund_explain_desc'
- },
- data => {
- this.refundExplainDesc = data;
- }
- );
- },
- // 获取退款详情
- getOrderDet() {
- req.getRequest(
- '/api/order/detail',
- {
- id: this.id
- },
- data => {
- // if (this.multiple == 1 && data.orderType != 11) {
- this.setData(data);
- console.log('this.multiple==',this.multiple)
- if (this.multiple == 1) {
- for (var i = 0; i < data.deliverList.length; i++) {
- data.deliverList[i].extendDTOList.map(el => {
- el.refundQuantity = 1;
- return el;
- });
- data.deliverList[i].extendDTOList = data.deliverList[i].extendDTOList.filter(it => it.shouldQuantity - (it.refundStock ? it.refundStock : 0) > 0);
- }
- // console.log('可退数据000>>>>', data.deliverList);
- // && it.isRefundStock == 1
- this.deliverListss = data.deliverList.filter(it => it.extendDTOList.length > 0 && it.isRefundStock == 1);
- console.log('可退数据000>>>>', this.deliverListss);
- if(this.deliverListss&&this.deliverListss.length >0){
- if(this.deliverListss&&this.deliverListss.length == 1){
- // this.checkProduct(0,0);
- // this.showAll = false;
- // }else{
- this.deliverListss.map((it,index)=>{
- if(index == 0){
- if(it.extendDTOList&&it.extendDTOList.length == 1){
- this.checkProduct(0,0)
- }
- }
- if(it.extendDTOList&&it.extendDTOList.length > 1){
- this.showAll = true;
- }else{
- this.showAll = false;
- }
- })
- }else{
- this.showAll = true;
- }
- }
- // console.log('可退数据111>>>>', JSON.stringify(this.deliverListss));
- // data.products.map(el => {
- // el.refundQuantity = 1;
- // return el;
- // });
- // data.products = data.products.filter(it => it.quantity - (it.refundStock ? it.refundStock : 0) > 0);
- } else {
- if (data.balancePayMoney && data.balancePayMoney > 0) {
- this.allMoney = parseFloat(data.payMoney + data.balancePayMoney).toFixed(2);
- }
- }
- this.isShowPage = true;
- }
- );
- },
- checkProduct(index, idx) {
- // debugger
- //选择商品
- const that = this;
- let d = {};
- if (index == -1) {
- // 全选
- // console.log("全选");
- const isAll = that.isAll;
- for (let i = 0, len = this.deliverListss.length; i < len; i++) {
- for (let k = 0, length = this.deliverListss[i].extendDTOList.length; k < length; k++) {
- this.deliverListss[i].extendDTOList[k].isActive = !isAll;
- }
- }
- this.isAll = !isAll;
- } else {
- // 单选
- this.deliverListss[index].extendDTOList[idx].isActive = !this.deliverListss[index].extendDTOList[idx].isActive;
- }
- // console.log(this.products);
- if (index != -1) {
- this.isAll = this.merchantCheckProduct();
- }
- this.CalculationMoney(index, idx);
- },
- // 判断店铺的商品是否全部选择
- merchantCheckProduct() {
- let d = {}; // debugger
- for (let i = 0, len = this.deliverListss.length; i < len; i++) {
- for (let k = 0, length = this.deliverListss[i].extendDTOList.length; k < length; k++) {
- if (!this.deliverListss[i].extendDTOList[k].isActive) {
- return false;
- }
- }
- }
- return true;
- },
- CalculationMoney() {
- //计算商品总价格
- let jsdMoney = 0;
- let nmoney = 0.0;
- let integral = 0;
- let arr = [];
- let obj = {};
- for (let i = 0, len = this.deliverListss.length; i < len; i++) {
- for (let k = 0, length = this.deliverListss[i].extendDTOList.length; k < length; k++) {
- var lst = this.deliverListss[i].extendDTOList[k];
- if (lst.isActive) {
- jsdMoney += lst.refundQuantity * lst.money;
- integral += lst.refundQuantity * lst.integral;
- // obj = {
- // id: lst.id,
- // quantity: lst.quantity,
- // // 单价
- // actualPrice: lst.actualPrice,
- // skuId: lst.skuId,
- // refundQuantity: lst.refundQuantity,
- // salePrice: lst.salePrice,
- // orderProductId: lst.orderProductId
- // };
- obj = {
- id: lst.productId,
- deliveryInformation: lst.deliverId, //出库单ID
- quantity: lst.shouldQuantity,
- skuId: lst.skuId,
- isOtc: lst.isOtc,
- pic: lst.pic,
- refundQuantity: lst.refundQuantity,
- // 单价
- actualPrice: lst.money,
- salePrice: lst.salePrice,
- orderProductId: lst.orderProductId
- };
- arr.push(obj);
- }
- }
- }
- // this.products
- // .filter(it => it.isActive)
- // .forEach(lst => {
- // jsdMoney += lst.refundQuantity * lst.money;
- // integral += lst.refundQuantity * lst.integral;
- // obj = {
- // id: lst.id,
- // quantity: lst.quantity,
- // // 单价
- // actualPrice: lst.actualPrice,
- // skuId: lst.skuId,
- // isOtc: lst.isOtc,
- // pic: lst.pic,
- // refundQuantity: lst.refundQuantity,
- // salePrice: lst.salePrice,
- // orderProductId: lst.orderProductId
- // };
- // arr.push(obj);
- // });
- nmoney = Number(jsdMoney);
- //得到可退金额,如果存在退差的情况
- if (this.difference && this.difference > 0) {
- //退差金额不为空并且》0;
- //用订单的实付金额-退差金额;判断需要退的金额是否大于可退金额;如果大,则需要-退差金额-正在退、或者已退金额
- var keMoney = this.getKeMoney(); //可退金额
- if (nmoney > keMoney) {
- nmoney = nmoney - this.difference;
- }
- }
-
- // //计算是否需要退邮费
- // if(this.expressFee&&this.expressFee>0){//订单是否存在邮费
-
- // }
-
- this.setData({
- allMoney: parseFloat(nmoney).toFixed(2) > 0 ? parseFloat(nmoney).toFixed(2) : 0,
- integral: integral,
- list: arr
- });
- },
- //获取已退、在退中金额
- getKeMoney() {
- //用订单的实付金额-退差金额;判断需要退的金额是否大于可退金额;如果大,则需要-退差金额-正在退、或者已退金额
- //32 审核失败 42退款失败 49取消售后
- var list = this.orderRefundList.filter(it => it.refundState != 32 && it.refundState != 42 && it.refundState != 49);
- var refundMoney = 0;
- for (var i = 0; i < list.length; i++) {
- refundMoney = refundMoney + list[i].refundMoney;
- }
- var keMoney = parseFloat(this.money - this.difference - refundMoney).toFixed(2); //可退金额
- return keMoney;
- },
- jianQuantity(index, idx) {
- const page = this.deliverListss[index].extendDTOList[idx];
- if (page.refundQuantity <= 1) return false;
- this.deliverListss[index].extendDTOList[idx].refundQuantity = parseInt(page.refundQuantity) - 1;
- this.CalculationMoney(index, idx);
- },
- jiaQuantity(index, idx) {
- const page = this.deliverListss[index].extendDTOList[idx];
- let q = parseInt(page.refundQuantity) + 1;
- if (page.shouldQuantity > 0) {
- if (page.refundStock > 0) {
- if (q > page.shouldQuantity - page.refundStock) return req.msg('非常的抱歉,不能超过可退数量');
- else {
- q = parseInt(page.refundQuantity) + 1;
- }
- } else {
- if (q > page.shouldQuantity) return req.msg('非常的抱歉,不能超过可退数量');
- else {
- q = parseInt(page.refundQuantity) + 1;
- }
- }
- }
- this.deliverListss[index].extendDTOList[idx].refundQuantity = q;
- this.CalculationMoney(index, idx);
- },
- // 获取输入的值
- getNum(event) {
- const index = event.currentTarget.dataset.index;
- const idx = event.currentTarget.dataset.idx;
- const page = this.deliverListss[index].extendDTOList[idx];
- let q = event.detail.value;
- if (page.refundStock > 0) {
- if (q > page.shouldQuantity - page.refundStock) {
- req.msg('非常的抱歉,不能超过可退数量');
- q = page.shouldQuantity - page.refundStock;
- } else {
- q = event.detail.value;
- }
- } else {
- if (q > page.shouldQuantity) {
- req.msg('非常的抱歉,不能超过可退数量');
- q = page.shouldQuantity;
- } else {
- q = event.detail.value;
- }
- }
- this.deliverListss[index].extendDTOList[idx].refundQuantity = q;
- this.CalculationMoney(index, idx);
- return q;
- },
- minNum(event) {
- const index = event.currentTarget.dataset.index;
- const idx = event.currentTarget.dataset.idx;
- const page = this.deliverListss[index].extendDTOList[idx];
- let that = this;
- if (event.detail.value == '') {
- let q = 1;
- this.deliverListss[index].extendDTOList[idx].refundQuantity = q;
- } else {
- let q = parseInt(event.detail.value);
- if (page.refundStock > 0) {
- if (q > page.shouldQuantity - page.refundStock) {
- req.msg('非常的抱歉,不能超过可退数量');
- q = page.shouldQuantity - page.refundStock;
- }
- } else {
- if (q > page.shouldQuantity) {
- req.msg('非常的抱歉,不能超过可退数量');
- q = page.shouldQuantity;
- }
- }
- this.deliverListss[index].extendDTOList[idx].refundQuantity = q;
- that.CalculationMoney(index, idx);
- return q;
- }
- },
- // 获取退款原因
- getRefund(event) {
- this.setData({
- isShow: true,
- type: event.currentTarget.dataset.isrefund
- });
- },
- hidePopup() {
- this.setData({
- isShow: false
- });
- },
- getValue: function(e) {
- // console.log(e);
- if (this.type == 1) {
- this.setData({
- refund: e.detail
- });
- }
- if (this.type == 2) {
- this.setData({
- huo: e.detail
- });
- }
- if (this.type == 3) {
- this.setData({
- start: e.detail
- });
- } // console.log(e.detail);
- },
- getIndex: function(e) {
- if (this.type == 1) {
- this.setData({
- refundIndex: e.detail
- });
- }
- if (this.type == 2) {
- this.setData({
- huoIndex: e.detail
- });
- }
- if (this.type == 3) {
- this.setData({
- startIndex: e.detail
- });
- }
- // console.log(e.detail);
- },
- // 获取退款说明
- getShuoming(event) {
- let shuoming = '';
- shuoming = event.detail.value;
- this.setData({
- shuoming: shuoming
- });
- // console.log(this.shuoming);
- },
- //上传图片
- uploadAvatar() {
- let that = this;
- uni.chooseImage({
- count: 3,
- sizeType: ['original', 'compressed'],
- sourceType: ['album', 'camera'],
- success: function({ tempFilePaths }) {
- var promise = Promise.all(
- tempFilePaths.map((tempFilePath, index) => {
- return new Promise(function(resolve, reject) {
- req.loadIng('上传中');
- req.uploadFile('/api/nocheck/upload', tempFilePath, res => {
- // console.log(res);
- that.setData({
- credentialsUrl: that.credentialsUrl.concat(res.src)
- });
- uni.showToast({
- title: '上传成功',
- icon: 'success',
- duration: 2000
- });
- // console.log(that.avatar);
- });
- });
- })
- );
- promise
- .then(function(results) {
- // console.log(results);
- })
- .catch(function(err) {
- // console.log(err);
- });
- }
- }); // wx.chooseImage({
- // count: 3,
- // sizeType: ['original', 'compressed'],
- // sourceType: ['album', 'camera'],
- // success(res) {
- // console.log(res.tempFilePaths)
- // req.uploadFile('/api/upload', res.tempFilePaths, res => {
- // req.msg('图片上传成功');
- // that.setData({
- // avatar: that.data.avatar.concat(res.src)
- // })
- // console.log(that.data.avatar)
- // })
- // }
- // })
- },
- // 删除图片
- cleanimage(event) {
- let index = event.currentTarget.dataset.index;
- let arr = this.credentialsUrl;
- arr.splice(index, 1);
- this.setData({
- credentialsUrl: arr
- });
- },
- save: util.throttle(function() {
- let that = this;
- requsetmessage.refund().then(res => {
- // console.log("退款", res);
- that.saveRefund();
- });
- }, 1500),
- saveRefund() {
- console.log('数据>>>>>>>>>>', this.list);
- let parameter = {
- refundType: this.isrefund,
- orderId: this.id,
- imgUrl: this.credentialsUrl.toString(),
- remarks: this.shuoming,
- refundReason: this.refundIndex
- };
- // if (this.multiple == 1 && this.orderType != 11) {
- if (this.multiple == 1) {
- if (this.list.length < 1) {
- return req.msg('请您选择退款商品');
- } else {
- //遍历组装数据
- var dataList = [];
- // [
- // {"refundMoney":"100",
- // "deliverId":"1000",
- // "refundProductList":[]
- // }
- // ]
- for (var i = 0; i < this.list.length; i++) {
- if (dataList.length == 0) {
- var obj = {
- refundMoney: parseFloat(this.list[i].actualPrice * this.list[i].refundQuantity).toFixed(2),
- deliverId: this.list[i].deliveryInformation,
- refundProductList: []
- };
- this.list[i].isAdd = true;
- obj.refundProductList.push(this.list[i]);
- dataList.push(obj);
- } else {
- for (var k = 0; k < dataList.length; k++) {
- if (dataList[k].deliverId == this.list[i].deliveryInformation) {
- //检验是否被添加过了
- if (!this.list[i].isAdd) {
- dataList[k].refundMoney = parseFloat(parseFloat(dataList[k].refundMoney) + this.list[i].actualPrice * this.list[i].refundQuantity).toFixed(
- 2
- );
- this.list[i].isAdd = true;
- dataList[k].refundProductList.push(this.list[i]);
- }
- } else {
- if (!this.list[i].isAdd) {
- var obj = {
- refundMoney: parseFloat(this.list[i].actualPrice * this.list[i].refundQuantity).toFixed(2),
- deliverId: this.list[i].deliveryInformation,
- refundProductList: []
- };
- this.list[i].isAdd = true;
- obj.refundProductList.push(this.list[i]);
- dataList.push(obj);
- }
- }
- }
- }
- }
- parameter.jsonStr = JSON.stringify(dataList);
- console.log('>>>>>', parameter.jsonStr);
- }
- parameter.refundMoney = this.allMoney;
- } else {
- parameter.refundMoney = this.payMoney;
- if (this.balancePayMoney && this.balancePayMoney > 0) {
- parameter.refundMoney = parseFloat(this.payMoney + this.balancePayMoney).toFixed(2);
- }
- }
- if (this.isrefund == 2) {
- parameter.refundGoodState = this.startIndex;
- parameter.refundMethod = this.huoIndex;
- if (this.refundMethod != 5) {
- if (!parameter.refundGoodState) {
- return req.msg('请您填写货物状态');
- }
- }
- if (!parameter.refundMethod) {
- return req.msg('请您填写退货方式');
- }
- }
- if (this.refundMethod != 5) {
- if (!parameter.refundReason) {
- return req.msg('请您填写退款原因');
- }
- }
- //退货时,是必须强制需要提交照片
- // if ((!this.avatar || this.avatar.length == 0)&&this.isrefund==2) {
- // return req.msg('请上传凭证照片');
- // }
-
- if(this.credentialsUrl){
- parameter.imgUrl = this.credentialsUrl.toString();
- }
-
- parameter.apiType = 1; //等于1时走新的退款流程;未传的走老退款流程
- req.postRequest('/api/orderRefund/save', parameter, data => {
- // uni.redirectTo({
- // url: '/mine/refund/refundDetails/refundDetails?id=' + data[0] + '&isrefund=' + this.isrefund
- // });
- req.msg('售后申请提交成功');
- setTimeout(function() {
- uni.navigateBack();
- }, 2000);
- });
- },
- upData() {
- let parameter = {
- refundType: this.isrefund,
- id: this.id
- };
- parameter.refundMethod = this.huoIndex;
- if (this.huoIndex == 1) {
- parameter.RefundState = 35;
- } else {
- parameter.RefundState = 36;
- }
- req.putRequest('/api/orderRefund/update', parameter, data => {
- uni.navigateBack();
- });
- }
- }
- };
- </script>
- <style>
- @import './applyRefund.css';
- </style>
|