quanwei
2025-11-21 1db9a4130699636cabe7e0c9f7f15d004aadada0
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
50
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
88
89
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
<template>
    <view class="refund-apply pb100" v-if="!loadding">
        <form @submit="formSubmit" @reset="formReset">
            <view class="one-product d-s-c p30 bg-white ">
                <view class="cover">
                    <image :src="product.image.file_path || ''" mode="aspectFit"></image>
                </view>
                <view class="flex-1">
                    <view class="pro-info">{{product.product_name}}</view>
                    <view class="pt10 p-0-30 f24 gray9">
                        <text class="">
                            单价:¥{{product.line_price}}
                        </text>
                        <text class="ml20">
                            数量:{{product.total_num}}
                        </text>
                    </view>
                </view>
            </view>
 
            <!-- 服务类型 -->
            <view class="group bg-white">
                <view class="group-hd border-b-e">
                    <view class="left">
                        <text class="min-name">服务类型</text>
                    </view>
                </view>
                <view class="d-s-c p-20-0">
                    <button v-if="product.orderM.delivery_type.value!=30" type="default"
                        :class="type==10?'btn-red-border':''" @click="tabType(10)">退货/退款</button>
                    <button v-if="product.orderM.delivery_type.value!=30" type="default"
                        :class="type==20?'ml20 btn-red-border':'ml20'" @click="tabType(20)">换货</button>
                    <button v-if="product.orderM.delivery_type.value!=30" type="default"
                        :class="type==30?'ml20 btn-red-border':'ml20'" @click="tabType(30)">仅退款</button>
                </view>
            </view>
 
            <!--申请原因-->
            <view class="group bg-white">
                <view class="group-hd">
                    <view class="left">
                        <text class="min-name">申请原因</text>
                    </view>
                </view>
                <view class="d-s-c">
                    <textarea class="p10 box-s-b border flex-1 f28 lh150" value="" name="content"
                        placeholder="请详细填写申请原因,注意保持商品的完好,建议您先与卖家沟通" />
                </view>
            </view>
 
            <!--退款金额-->
            <view class="group bg-white" v-if="type==10 || type==30">
                <view class="group-hd">
                    <view class="left">
                        <text class="min-name">退款金额:</text>
                        <text class="red f30" >¥{{product.total_pay_price}}</text>
                    </view>
                </view>
            </view>
 
            <!--上传图片-->
            <view class="group bg-white">
                <view class="group-hd">
                    <view class="left">
                        <text class="min-name">上传凭证</text>
                        <text class="gray9">(最多6张)</text>
                    </view>
                </view>
                <view class="upload-list d-s-c">
                    <view class="item" v-for="(imgs,img_num) in images" :key="img_num" @click="deleteFunc(imgs)">
                        <image :src="imgs.file_path" mode="aspectFit"></image>
                    </view>
                    <view class="item d-c-c d-stretch" v-if="images.length<6">
                        <view class="upload-btn d-c-c d-c flex-1" @click="openUpload()">
                            <text class="icon iconfont icon-xiangji f34"></text>
                            <text class="gray9">上传图片</text>
                        </view>
                    </view>
                </view>
            </view>
 
            <view class="foot-btns">
                <button form-type="submit" class="btn-red">确认提交</button>
            </view>
        </form>
        <!--上传图片-->
        <Upload v-if="isUpload" @getImgs="getImgsFunc"></Upload>
    </view>
 
 
</template>
 
<script>
    import Upload from '@/components/upload/upload.vue';
    export default {
        components: {
            Upload
        },
        data() {
            return {
                /*是否加载完成*/
                loadding: true,
                indicatorDots: true,
                autoplay: true,
                interval: 2000,
                duration: 500,
                type: 10,
                /*是否打开上传图片*/
                isUpload:false,
                /*订单商品id*/
                order_product_id: 0,
                /*订单商品*/
                product: {
                    image:{
                        file_path:''
                    }
                },
                images:[],
                /*小程序订阅消息*/
                temlIds: [],
            }
        },
        onLoad(e){
            this.order_product_id = e.order_product_id;
        },
        mounted() {
            /*获取订单详情*/
            this.getData();
        },
        methods: {
            /*获取数据*/
            getData(){
                let self = this;
                uni.showLoading({
                    title: '加载中'
                });
                self.loadding = true;
                let order_product_id = self.order_product_id;
                self._get('user.refund/apply', {
                    order_product_id: order_product_id,
                    platform: self.getPlatform()
                }, function(res) {
                    self.loadding = false;
                    self.product = res.data.detail;
                    self.temlIds = res.data.template_arr;
                    if (self.product.orderM.delivery_type.value == 30) {
                        self.type = 30;
                    }
                    uni.hideLoading();
                });
            },
            /*切换服务类型*/
            tabType(e) {
                this.type = e;
            },
 
            /*提交表单*/
            formSubmit: function(e) {
                let self = this;
                var formdata = e.detail.value;
                formdata.type = self.type;
                formdata.order_product_id = self.order_product_id;
                formdata.images = JSON.stringify(self.images);
                let callback = function() {
                    uni.showLoading({
                        title: '正在提交',
                        mask: true
                    });
                    self._post('user.refund/apply', formdata, function(res) {
                        uni.hideLoading();
                        uni.showToast({
                            title: res.msg,
                            duration: 3000,
                            complete:function(){
                                self.gotoPage('/pages/order/refund/index/index');
                            }
                        });
                    });
                } 
                self.subMessage(self.temlIds, callback);
            },
            
            /*打开上传图片*/
            openUpload(){
                this.isUpload=true;
            },
            
            /*获取上传的图片*/
            getImgsFunc(e){
                let self=this;
                self.isUpload=false;
                if(e&&typeof(e)!='undefined'){
                    let this_length=self.images.length,
                    upload_length=e.length;
                    if(this_length+upload_length<7){
                        self.images=self.images.concat(e);
                    }else{
                        let leng=6-this_length;
                        for(let i=0;i<leng;i++){
                            self.images.push(e[i]);
                        }
                    }
                }
            },
            /*删除图片*/
            deleteFunc(e){
                this.images.splice(e,1);
            }
        }
    }
</script>
 
<style>
 
</style>