123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241 |
- <template>
- <view style="padding: 30rpx;">
- <view class="topBox">
- <view>
- <u-icon name="error-circle-fill" color="#FF3B30" size="28"></u-icon>
- <text style="color: #FF3B30;margin-left: 10rpx;">学习前请提交完整审核资料</text>
- </view>
- <view style="color: #007AFF;">稍后再填</view>
- </view>
- <view class="bodyBox" style="margin-top: 30rpx;padding:0 20rpx;">
- <u-form :model="form" ref="uForm">
- <template v-for="(item, index) in listData">
- <u-form-item
- v-if="item.inputType == 4"
- :key="index"
- :label="item.fieldName"
- :required="item.required"
- :label-width="auto"
- :prop="item.required ? item.fieldKey : ''"
- label-position="top"
- >
- <text style="color: blue;position: absolute;top: 20rpx;left: 180rpx;text-decoration: underline;" @click="downDocx(item.url)">点击下载</text>
- <view class="dis_stys"><text style="color: #999999;">下载承诺书进行填写并签名盖章后上传(≤2M)</text></view>
- <view style="width: 169rpx; height: 169rpx;position: relative;">
- <image v-if="!form[item.fieldKey]" style="width: 100%; height: 100%;" @click="uploadFieds" src="@/static/info_4.png"></image>
- <image v-if="form[item.fieldKey]" src="@/static/icon/jy_icon.png" style="width: 100%; height: 100%;"></image>
- <u-icon v-if="form[item.fieldKey]" name="close-circle-fill" color="red" size="44" class="optionsAbs" @click="clearWord"></u-icon>
- </view>
- </u-form-item>
- </template>
- </u-form>
- </view>
- <!-- <view style="width: 169rpx; height: 169rpx;position: relative;">
- <image v-if="!form.commitment_seal" style="width: 100%; height: 100%;" @click="uploadFieds" src="@/static/info_4.png"></image>
- <image v-if="form.commitment_seal" src="@/static/icon/jy_icon.png" style="width: 100%; height: 100%;"></image>
- <u-icon v-if="form.commitment_seal" name="close-circle-fill" color="red" size="44" class="optionsAbs" @click="clearWord"></u-icon>
- </view> -->
- <view @click="submits" class="submit_btn">提交资料</view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- form: {
- commitment_seal: ''
- },
- goodsId: null,
- fileList1: [],
- listData: {}, //页面数据
- openVerify: false, // 控制是否手动验证
- nextStatus: false, //是否有下一步
- copyData: null,
- rules: {
- commitment_seal: [
- {
- required: true,
- message: '请上传承诺书盖章',
- trigger: ['change', 'blur']
- }
- ]
- }
- };
- },
- created() {},
- onLoad(option) {
- this.goodsId = Number(option.id);
- this.getInfo();
- },
- onReady() {
- this.$refs.uForm.setRules(this.rules);
- },
- methods: {
- downDocx(url){
- uni.downloadFile({
- url: this.$method.splitImgHost(url),
- success: (res) => {
- if (res.statusCode === 200) {
- console.log(this.$method.splitImgHost(url))
- this.$method.showToast("下载成功")
- }
- }
- });
- },
- clearWord() {
- this.$set(this.form, 'commitment_seal', '');
- },
- uploadFieds() {
- var self = this
- wx.chooseMessageFile({
- count: 1,
- size: 2097152,
- type: 'file',
- success(res) {
- if (res.tempFiles[0].size > 2097152) {
- self.$method.showToast('上传文件不得大于2M');
- return;
- } else {
- self.$set(self.form, 'commitment_seal', res.tempFiles[0].path);
- self.$nextTick(function() {
- this.resultForm();
- });
- }
- }
- });
- },
- //提交表单
- async submitApi() {
- var data = JSON.parse(JSON.stringify(this.form));
- if (data['commitment_seal']) {
- data.commitment_seal = await this.$method.uploadFile(data.commitment_seal, 0);
- }
- var concatData = {}
- Object.assign(concatData,this.copyData,data)
- console.log(concatData);
- },
- //验证表单
- resultForm(int) {
- if (this.openVerify) {
- this.$refs.uForm.validate(valid => {
- if (valid) {
- if (int === 1) {
- this.submitApi();
- }
- } else {
- console.log('验证失败');
- }
- });
- }
- },
- submits() {
- this.openVerify = true;
- this.resultForm(1);
- },
- async changePhotoListHeader1(lists, name) {
- if (lists.length) {
- this.fileList1 = lists;
- this.form.commitment_seal = await this.$method.imageInfos(lists[0].url);
- } else {
- this.fileList1 = [];
- this.$set(this.form, 'commitment_seal', '');
- }
- this.$nextTick(function() {
- this.resultForm();
- });
- },
- getInfo() {
- // this.copyData = this.$store.getters.getCopyData
- this.copyData = {
- name: '唐立安',
- sex: '男'
- };
- this.$api.getbaseprofiletpId(this.goodsId).then(res => {
- var ast = JSON.parse(res.data.data.keyValue2);
- this.listData = ast;
- });
- }
- }
- };
- </script>
- <style>
- page {
- background: #eaeef1;
- }
- </style>
- <style scope>
- .optionsAbs {
- position: absolute;
- z-index: 99;
- top: 10rpx;
- right: 10rpx;
- }
- .dis_stys {
- display: flex;
- align-items: center;
- justify-content: space-between;
- }
- .handCenter {
- background: #f7f7f7;
- border: 2rpx solid #eeeeee;
- border-radius: 24rpx;
- }
- .headerSDels {
- height: 58rpx;
- padding: 0rpx 24rpx;
- font-weight: bold;
- display: flex;
- align-items: center;
- flex-direction: row-reverse;
- }
- .listBox {
- margin: 24rpx 32rpx 0rpx;
- box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
- border-radius: 32rpx;
- background-color: #fff;
- overflow: hidden;
- }
- .imgBoxs {
- width: 156rpx;
- height: 203rpx;
- }
- .imgBoxs2 {
- width: 171rpx;
- height: 108rpx;
- }
- .submit_btn {
- width: 526rpx;
- height: 80rpx;
- background: #007aff;
- border-radius: 40rpx;
- text-align: center;
- line-height: 80rpx;
- color: #ffffff;
- margin: 30rpx auto;
- }
- .picker {
- text-align: right;
- }
- input {
- text-align: right;
- }
- .bodyBox {
- background: #ffffff;
- border-radius: 24rpx;
- width: 100%;
- }
- .topBox {
- height: 80rpx;
- background: #ffffff;
- border-radius: 24rpx;
- width: 100%;
- display: flex;
- justify-content: space-between;
- line-height: 80rpx;
- padding: 0 20rpx;
- font-size: 24rpx;
- }
- </style>
|