liangjin
2021-04-04 6ab8cacad8580c7d297609d6583b46b89310ff6f
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
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
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
<!--
 * @Author: 小明丶
 * @Date: 2019-08-30 18:04:49
 * @LastEditors: 小明丶
 * @LastEditTime: 2021-01-04 15:30:29
 * @Description:
 -->
/*
 * @Author: c.y
 * @Date: 2018-12-24 15:04:57
 * @Last Modified by: mikey.zhaopeng
 * @Last Modified time: 2019-11-15 09:02:18
 * @文件说明:花呗分期--开通花呗--上传门店相关照片
 */
<template>
  <div class="huabei-picture-page">
    <x-header
      :title="'开通' + this.$route.query.title"
      :left-options="{backText:'',preventGoBack:true}"
      @on-click-back="pageGoBack()"
    ></x-header>
    <group v-if="alAccountTypeList instanceof Array && alAccountTypeList.length">
      <selector
        :title="isddxt?'商户类型':'支付宝类型'"
        ref="insTerm"
        placeholder="请选择"
        v-model="accountType"
        :options="alAccountTypeList"
        :value-map="['code', 'name']"
        direction="rtl"
      ></selector>
    </group>
    <div class="pic-content">
      <UploadFile
        :fileType="0"
        :title="isddxt && accountType == 3?'民办非企业登记证书':'营业执照'"
        :typeId="this.$route.query.typeId"
        :sourceType="this.$route.query.zfbVersion"
        :picList="uploadObj.licencePhotos"
      ></UploadFile>
      <UploadFile
        v-if="isddxt && accountType == 3"
        :fileType="24"
        :title="'办学许可证'"
        :typeId="this.$route.query.typeId"
        :sourceType="this.$route.query.zfbVersion"
        :picList="uploadObj.schoolPermit"
      ></UploadFile>
      <UploadFile
        :fileType="2"
        :title="'身份证正面照'"
        :typeId="this.$route.query.typeId"
        :sourceType="this.$route.query.zfbVersion"
        :picList="uploadObj.cardFrontPhotos"
      ></UploadFile>
      <UploadFile
        :fileType="3"
        :title="'身份证反面照'"
        :typeId="this.$route.query.typeId"
        :sourceType="this.$route.query.zfbVersion"
        :picList="uploadObj.cardBackPhotos"
      ></UploadFile>
      <UploadFile
        :fileType="6"
        :title="'门店店内照'"
        :typeId="this.$route.query.typeId"
        :sourceType="this.$route.query.zfbVersion"
        :picList="uploadObj.storeInnerPhotos"
      ></UploadFile>
      <UploadFile
        :fileType="7"
        :title="'门店招牌照'"
        :typeId="this.$route.query.typeId"
        :sourceType="this.$route.query.zfbVersion"
        :picList="uploadObj.storeSignPhotos"
      ></UploadFile>
    </div>
    <f-space></f-space>
    <f-button @on-click="handleOpenHuaBei">提交开通</f-button>
  </div>
</template>
 
<script>
import UploadFile from "@/components/old/upload/uploadImg";
 
export default {
  name: "add-account",
  components: {
    UploadFile
  },
  data() {
    return {
      alAccountTypeList: [],
      accountType: "", // 选择的账号类型
      uploadObj: {
        licencePhotos: [], // 营业执照
        schoolPermit:[],//办学许可证
        cardFrontPhotos: [], // 身份证正面照
        cardBackPhotos: [], // 身份证反面照
        storeSignPhotos: [], // 门店招牌照
        storeInnerPhotos: [] // 门店店内照
      }
    };
  },
  computed:{
    isddxt(){
      if(sessionStorage.isddxt == 1 || this.$route.query.zfbVersion == 6){
        return true
      }else{
        return false
      }
    }
  },
  methods: {
    pageGoBack() {
      if(this.$route.query.isApp == 1){
        this.$router.go(-1)
      }else{
        if (this.$route.query.accountType) {
          this.$router.push({
            path: "/huabei/alipay",
            query: { accountType: this.$route.query.accountType,...this.$route.query }
          });
        } else {
          this.$router.push({
            path: "/huabei/alipay",
            query: { ...this.$route.query }
          });
        }
      }
 
    },
    // 开通花呗
    handleOpenHuaBei() {
      if (this.$tool.checkValEmpty(this.accountType)) {
        this.$tool.toast("请选择支付宝类型");
        return false;
      }
      if (this.$tool.checkValEmpty(this.uploadObj.licencePhotos)) {
        let str ;
        if(this.isddxt){
          str="请上传营业执照"
        }else{
          str="民办非企业登记证书"
        }
        this.$tool.toast(str);
        return false;
      }
      if (this.$tool.checkValEmpty(this.uploadObj.schoolPermit)&&this.isddxt && this.accountType == 3) {
        this.$tool.toast("请上传办学许可证");
        return false;
      }
      if (this.$tool.checkValEmpty(this.uploadObj.cardFrontPhotos)) {
        this.$tool.toast("请上传身份证正面照");
        return false;
      }
      if (this.$tool.checkValEmpty(this.uploadObj.cardBackPhotos)) {
        this.$tool.toast("请上传身份证反面照");
        return false;
      }
      if (this.$tool.checkValEmpty(this.uploadObj.storeSignPhotos)) {
        this.$tool.toast("请上传门店招牌照");
        return false;
      }
      if (this.$tool.checkValEmpty(this.uploadObj.storeInnerPhotos)) {
        this.$tool.toast("请上传门店店内照");
        return false;
      }
        console.log(this.uploadObj)
      let picIdList = {
        licencePhotos: [],
        schoolPermit:[],
        cardFrontPhotos: [],
        cardBackPhotos: [],
        storeSignPhotos: [],
        storeInnerPhotos: []
      };
 
      for (let i in this.uploadObj) {
        this.uploadObj[i].forEach(item => {
          picIdList[i].push(item.id + "");
        });
      }
      console.log(JSON.parse(sessionStorage.getItem("huabei_addr")));
      let submitInfo = {
        aliAccount: sessionStorage.getItem("huabei_accountNumber"),
        aliAccountName: sessionStorage.getItem("huabei_accountName"),
        servicePhone: sessionStorage.getItem("huabei_servicePhone"),
        addr: JSON.parse(sessionStorage.getItem("huabei_addr")),
        aliAccountType: this.accountType,
        zfbVersion: this.$route.query.zfbVersion,
        ...picIdList
      };
      // if(sessionStorage.isddxt==1){
      //   submitInfo.mcc = Number(JSON.parse(sessionStorage.getItem('huabei_category')))
      // }
      console.log(submitInfo);
      // if (this.$route.query.typeId == "200011") {
      //   this.$api.hbOpenXygOpen(submitInfo).then(res => {
      //     this.$router.push({
      //       path: "/huabei/open-result",
      //       query: {
      //         title: "信用购-花呗分期",
      //         ...this.$route.query
      //       }
      //     });
      //   });
      // } else {
        this.$api.hbOpenOpen(submitInfo).then(res => {
          this.$router.push({
            path: "/huabei/open-result",
            query: {
              title: "花呗分期",
              ...this.$route.query
            }
          });
        });
      // }
    },
    //   获取返显资料
    getMyMation() {
      if (sessionStorage.getItem("huabei_detailInfo")) {
        console.log(JSON.parse(sessionStorage.getItem("huabei_detailInfo")));
        var obj = JSON.parse(sessionStorage.getItem("huabei_detailInfo"));
        if(obj.aliAccountType){
            this.accountType = obj.aliAccountType
        }
        if(obj.licencePhotos && obj.licencePhotos.length > 0){
            this.uploadObj.licencePhotos = obj.licencePhotos
        }
        if(obj.schoolPermit && obj.schoolPermit.length > 0){
            this.uploadObj.schoolPermit = obj.schoolPermit
        }
        if(obj.cardFrontPhotos && obj.cardFrontPhotos.length > 0){
            this.uploadObj.cardFrontPhotos = obj.cardFrontPhotos
        }
        if(obj.cardBackPhotos && obj.cardBackPhotos.length > 0){
            this.uploadObj.cardBackPhotos = obj.cardBackPhotos
        }
        if(obj.storeSignPhotos && obj.storeSignPhotos.length > 0){
            this.uploadObj.storeSignPhotos = obj.storeSignPhotos
        }
        if(obj.storeInnerPhotos && obj.storeInnerPhotos.length > 0){
            this.uploadObj.storeInnerPhotos = obj.storeInnerPhotos
        }
      }
    }
  },
  created() {
    if (typeof sessionStorage.huabei_accountTypeList !== "undefined") {
      this.alAccountTypeList = JSON.parse(
        sessionStorage.getItem("huabei_accountTypeList")
      );
    }
    //this.getMyMation();
    this.accountType = "";
    this.uploadObj = {
      licencePhotos: [], // 营业执照
      schoolPermit:[],
      cardFrontPhotos: [], // 身份证正面照
      cardBackPhotos: [], // 身份证反面照
      storeSignPhotos: [], // 门店招牌照
      storeInnerPhotos: [] // 门店店内照
    };
    this.getMyMation();
  }
};
</script>
 
<style lang="less">
.huabei-picture-page {
  padding-top: 45px;
  background: @color-white;
  .pic-content {
    padding: 0 24px;
  }
}
</style>