index.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <template>
  2. <view class="container">
  3. <!-- 图片展示部分 -->
  4. <view class="container_qualifications" v-if="urlList.length">
  5. <view class="container_qualifications_title">
  6. <span class="margin_r">{{storeData.storeName}}</span>
  7. <span>网店经营者资质信息</span>
  8. </view>
  9. <view class="image_list">
  10. <!-- <view v-for="(item, index) in urlList" :key="index"><image :src="item" mode="widthFix"></image></view> -->
  11. <jyf-parser :domain='domain' :html="content" ref="article" :tag-style="tagStyle"></jyf-parser>
  12. </view>
  13. <view class="bottom_tip">
  14. 注:以上信息,由商家依据《电子商务法》规定发布公示。如需进一步核实,可联系商家客服咨询。
  15. </view>
  16. </view>
  17. <!-- 输入验证码部分 -->
  18. <view class="container_vercode" v-else>
  19. <view class="container_vercode_title"><text>输入验证码查看证件信息</text></view>
  20. <view class="container_vercode_content" >
  21. <view class="container_vercode_content_heightfix" >
  22. <view class="container_vercode_content_input">
  23. <input type="text" v-model="verCodeValue" placeholder="请输入验证码">
  24. </view>
  25. <!-- <view class="container_vercode_content_vercode" @click="getVerCodeImage" :style="{'background-image': `url(${captchaData.captcha})`}"> -->
  26. <view class="container_vercode_content_vercode" @click="getVerCodeImage">
  27. <image :src="captchaData.captcha" mode="widthFix"></image>
  28. </view>
  29. </view>
  30. </view>
  31. <view class="container_vercode_button"><view class="button" @click="submitCaptChaData">确定</view></view>
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. // +----------------------------------------------------------------------
  37. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  38. // +----------------------------------------------------------------------
  39. // | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved.
  40. // +----------------------------------------------------------------------
  41. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  42. // +----------------------------------------------------------------------
  43. // | Author: CRMEB Team <admin@crmeb.com>
  44. // +----------------------------------------------------------------------
  45. import { getCaptcha, storeCertificate } from '@/api/store.js';
  46. import { navigateTo, Toast, setStorage } from '@/libs/uniApi.js';
  47. import parser from "@/components/jyf-parser/jyf-parser";
  48. import { HTTP_REQUEST_URL } from '@/config/app';
  49. export default {
  50. components:{
  51. "jyf-parser": parser,
  52. },
  53. onLoad(opt) {
  54. this.storeData = opt;
  55. this.getVerCodeImage();
  56. },
  57. data() {
  58. return {
  59. storeData: {},
  60. captchaData: {},
  61. verCodeValue: '',
  62. urlList: [],
  63. tagStyle: {
  64. img: 'width:100%;display:block;'
  65. },
  66. content: '',
  67. domain: HTTP_REQUEST_URL,
  68. };
  69. },
  70. methods:{
  71. // 发送图片验证码,并请求资质图片列表
  72. submitCaptChaData() {
  73. if(this.verCodeValue) {
  74. storeCertificate({merId: this.storeData.mer_id, key: this.captchaData.key, code: this.verCodeValue}).then(res => {
  75. if(res.status == 200 && res.message == 'success') {
  76. this.urlList = res.data;
  77. this.content = '';
  78. let imgTap = '';
  79. this.urlList.forEach(item => {
  80. imgTap+=this.setImgTap(item);
  81. })
  82. this.content = `<p>${imgTap}</p>`;
  83. console.log(this.content);
  84. }
  85. }).catch(rej => {
  86. Toast(rej);
  87. this.getVerCodeImage();
  88. this.verCodeValue = '';
  89. })
  90. } else {
  91. Toast('请输入验证码');
  92. }
  93. },
  94. //
  95. setImgTap(url) {
  96. return `<img style="width:auto;height:auto;max-width:100%;margin-bottom:15px" src="${url}"></img>`
  97. },
  98. // 获取图片验证码
  99. getVerCodeImage() {
  100. getCaptcha().then(res => {
  101. if (res.status == 200 && res.message == 'success') {
  102. this.captchaData = res.data;
  103. console.log(this.captchaData);
  104. }
  105. });
  106. }
  107. }
  108. };
  109. </script>
  110. <style lang="scss" scoped>
  111. .container_vercode {
  112. &_title {
  113. text-align: center;
  114. padding: 30px 0;
  115. }
  116. &_content {
  117. width: 70%;
  118. height: 40px;
  119. margin: auto;
  120. margin-bottom: 20px;
  121. &_heightfix {
  122. width: 100%;
  123. display: flex;
  124. justify-content: space-between;
  125. align-items: center;
  126. border-radius: 4px;
  127. overflow: hidden;
  128. border: 1px solid rgba(0, 0, 0, 0.1);
  129. max-height: 34px;
  130. }
  131. &_input {
  132. flex: 1;
  133. box-sizing: border-box;
  134. input {
  135. font-size: 12px;
  136. padding: 0 20px;
  137. }
  138. }
  139. &_vercode {
  140. flex: 1;
  141. display: flex;
  142. align-items: center;
  143. justify-content: center;
  144. image {
  145. display: block;
  146. width: 100%;
  147. }
  148. }
  149. }
  150. &_button {
  151. .button {
  152. margin: auto;
  153. width: 70%;
  154. background: #e93323 !important;
  155. border-radius: 4px;
  156. padding: 12px;
  157. text-align: center;
  158. color: #fff;
  159. font-size: 12px;
  160. }
  161. }
  162. }
  163. .container_qualifications {
  164. &_title {
  165. padding: 10px;
  166. text-align: center;
  167. span:nth-child(1) {
  168. font-weight: bold;
  169. }
  170. }
  171. .image_list {
  172. view {
  173. width: 90%;
  174. margin: auto;
  175. image {
  176. width: 100%;
  177. }
  178. }
  179. }
  180. .bottom_tip {
  181. padding: 10px 0;
  182. width: 90%;
  183. margin: auto;
  184. line-height: 20px;
  185. }
  186. }
  187. .margin_r {
  188. margin-right: 8px;
  189. }
  190. </style>