supplierges.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460
  1. <template>
  2. <view class="content">
  3. <view class="headbox">
  4. <text class="headtitle">供货商注册</text>
  5. <view class="logobox">
  6. <image src="../../static/img/logo.png" mode="aspectFill"></image>
  7. </view>
  8. </view>
  9. <view class="acountbox">
  10. <view class="inacount">
  11. <text class="acoutitle">供货商</text>
  12. <input type="text" v-model="form.name" class="checkword" placeholder="请输入供货商名称"
  13. placeholder-style="font-size:30rpx;color:#BEBDBB" />
  14. </view>
  15. <view class="inacount">
  16. <text class="acoutitle">统一社会信用代码</text>
  17. <input type="text" v-model="form.socialCode" class="checkword" placeholder="请输入统一社会信用代码"
  18. placeholder-style="font-size:30rpx;color:#BEBDBB" />
  19. </view>
  20. <view class="inacount">
  21. <text class="acoutitle">法人姓名</text>
  22. <input type="text" v-model="form.legalPerson" class="checkword" placeholder="请输入法人姓名"
  23. placeholder-style="font-size:30rpx;color:#BEBDBB" />
  24. </view>
  25. <view class="inacount">
  26. <text class="acoutitle">联系人</text>
  27. <input type="text" v-model="form.contacts" class="checkword" placeholder="请输入联系人"
  28. placeholder-style="font-size:30rpx;color:#BEBDBB" />
  29. </view>
  30. <view class="inacount">
  31. <text class="acoutitle">联系电话</text>
  32. <input type="number" v-model="form.contactsMobile" class="checkword" placeholder="请输入联系电话"
  33. placeholder-style="font-size:30rpx;color:#BEBDBB" />
  34. </view>
  35. <view>
  36. <view class="inacount" style="flex-direction: column;align-items: center;background-color: #fff;">
  37. <text class="acoutitle" style="flex: 1;width: 100%;">认证照片</text>
  38. <view class="upmsg">
  39. <view class="uppic" style="padding-top: 80rpx;font-weight:600 ;" @click="upImages(1)"
  40. v-if="form.identifyPics.length==0">
  41. <text>点击上传照片</text>
  42. </view>
  43. <view class="img-up" style="width: 690rpx;height: 399rpx;" v-if="form.identifyPics.length>0" v-for="item in form.identifyPics">
  44. <image :src="item" mode="aspectFill"
  45. v-if="form.identifyPics.length>0" @click="upImages(1)"></image>
  46. <image @click="deletImg(index)" class="delet-img" src="../../static/icon/delet.png" style="width: 25px;height: 25px;" mode="aspectFill"></image>
  47. </view>
  48. </view>
  49. <text style="font-size: 24rpx;color: #D05C39;padding-top: 20rpx;">*注意上传法人手持身份证半身照</text>
  50. </view>
  51. </view>
  52. <view>
  53. <view class="inacount"
  54. style="flex-direction: column;align-items: center;background-color: #fff;margin-top:0 ;">
  55. <view style="justify-content: space-between;display: flex;width: 100%;">
  56. <text class="acoutitle" style="flex: 1;width: 100%;">授权委托书</text>
  57. <text class="acoutitle" style="flex: 1;width: 100%;text-align: right;" @click="addpdf"
  58. :style="[{color:(addpdfin?'#D05C39':'#000')},{fontSize:'28rpx'}]">点击获取授权委托书</text>
  59. </view>
  60. <view class="upmsg">
  61. <view class="uppic" style="padding-top: 80rpx;font-weight:600 ;" @click="upImages(2)"
  62. v-if="form.proxyFile.length==0">
  63. <text>点击上传照片</text>
  64. </view>
  65. <view class="img-up" style="width: 690rpx;height: 399rpx;"
  66. v-if="form.proxyFile.length>0"
  67. v-for="item in form.proxyFile">
  68. <image :src="item" mode="aspectFill" @click="upImages(2)"></image>
  69. <image @click="deletImg2(index)" class="delet-img"
  70. src="../../static/icon/delet.png" style="width: 25px;height: 25px;" mode="aspectFill">
  71. </image>
  72. </view>
  73. </view>
  74. <text style="font-size: 24rpx;color: #D05C39;padding-top: 20rpx;">*注意上传法人签署的授权委托书</text>
  75. </view>
  76. </view>
  77. </view>
  78. <view class="logininbtn" @click="acountRegister">
  79. <text>下一步</text>
  80. </view>
  81. <view class="safebt"></view>
  82. </view>
  83. </template>
  84. <script>
  85. import {
  86. mainUrl
  87. } from '@/http/baseUrl.js';
  88. let that
  89. export default {
  90. data() {
  91. return {
  92. checked: 1,
  93. form: {
  94. name: '',
  95. socialCode: '',
  96. legalPerson: '',
  97. password: '',
  98. contacts: '',
  99. contactsMobile: '',
  100. identifyPics: [],
  101. proxyFile: [],
  102. addpdfin: false
  103. },
  104. }
  105. },
  106. onLoad(o) {
  107. that = this
  108. if (o.checked) {
  109. this.checked = o.checked
  110. }
  111. },
  112. methods: {
  113. acountRegister() {
  114. let form = this.form
  115. if (form.name.length == 0) {
  116. this.$toast("请输入供货商名称")
  117. return
  118. }
  119. if (form.socialCode.length == 0) {
  120. this.$toast("请输入统一社会信用代码")
  121. return
  122. }
  123. if (form.legalPerson.length == 0) {
  124. this.$toast("请输入法人姓名")
  125. return
  126. }
  127. if (form.contacts.length == 0) {
  128. this.$toast("请输入联系人")
  129. return
  130. }
  131. if (form.contactsMobile.length == 0) {
  132. this.$toast("请输入联系电话")
  133. return
  134. }
  135. if (form.identifyPics.length == 0) {
  136. this.$toast("请上传认证照片")
  137. return
  138. }
  139. if (form.proxyFile.length == 0) {
  140. this.$toast("请上传授权委托书")
  141. return
  142. }
  143. form.checked = 1
  144. console.log(form)
  145. uni.$u.http.get(`/api/Supplier/name?name=${this.form.name}`, {
  146. name: that.form.name,
  147. }, {
  148. custom: {
  149. auth: true
  150. }
  151. }).then((res) => {
  152. console.log(res.data)
  153. if (res) {
  154. this.$toast("供货商名称已被使用,请重新填写")
  155. // uni.navigateTo({
  156. // url: "/pages/bsinessadmin/register?form="+JSON.stringify(form)
  157. // })
  158. }
  159. // console.log(that.suplist,999999999)
  160. }).catch((err) => {
  161. uni.hideLoading()
  162. console.log(err)
  163. if (!err.data) {
  164. uni.navigateTo({
  165. url: "/pages/bsinessadmin/register?form=" + JSON.stringify(form)
  166. })
  167. }
  168. })
  169. },
  170. //删除图片
  171. deletImg(i) {
  172. this.form.identifyPics.splice(i, 1)
  173. console.log(this.form.identifyPics);
  174. },
  175. deletImg2(i) {
  176. this.form.proxyFile.splice(i, 1)
  177. },
  178. addpdf() {
  179. this.addpdfin = true
  180. uni.showModal({
  181. title: '提示',
  182. content: "是否获取授权委托书?",
  183. success: function(res) {
  184. if (res.confirm) {
  185. uni.showLoading()
  186. uni.$u.http.get('/api/Setting/attorney', {
  187. custom: {
  188. auth: true
  189. }
  190. }).then((res) => {
  191. uni.hideLoading()
  192. uni.setClipboardData({
  193. data: res,
  194. success: function() {
  195. that.$toast("复制成功,请到浏览器下载")
  196. }
  197. });
  198. // that.downloadPdf(res)
  199. }).catch((err) => {
  200. uni.hideLoading()
  201. that.$toast(err.msg)
  202. })
  203. } else if (res.cancel) {
  204. }
  205. }
  206. })
  207. },
  208. downloadPdf(url) {
  209. console.log(url)
  210. uni.downloadFile({
  211. url: url, //下载地址接口返回
  212. header: {
  213. },
  214. success: (data) => {
  215. if (data.statusCode === 200) {
  216. console.log(22222)
  217. //文件保存到本地
  218. uni.saveFile({
  219. tempFilePath: data.tempFilePath, //临时路径
  220. success: function(res) {
  221. uni.showToast({
  222. icon: 'none',
  223. mask: true,
  224. title: '文件已保存:' + res.savedFilePath, //保存路径
  225. duration: 3000,
  226. });
  227. setTimeout(() => {
  228. //打开文档查看
  229. uni.openDocument({
  230. filePath: res.savedFilePath,
  231. success: function(res) {
  232. // console.log('打开文档成功');
  233. }
  234. });
  235. }, 3000)
  236. }
  237. });
  238. }
  239. },
  240. fail: (err) => {
  241. console.log(err);
  242. uni.showToast({
  243. icon: 'none',
  244. mask: true,
  245. title: '失败请重新下载',
  246. });
  247. },
  248. });
  249. },
  250. upImages(e) {
  251. if (e == 1) {
  252. this.chooseImage(1)
  253. } else if (e == 2) {
  254. this.chooseImage(2)
  255. }
  256. },
  257. chooseImage(u) {
  258. uni.chooseImage({
  259. count: 1,
  260. success: function(e) {
  261. for (let i in e.tempFilePaths) {
  262. let ui = that.upText(e.tempFilePaths[i], u)
  263. }
  264. },
  265. complete: function(e) {
  266. // 触发事件 tabEvent
  267. return []
  268. }
  269. })
  270. },
  271. upText(e, i) {
  272. var list = []
  273. uni.showLoading({
  274. })
  275. uni.uploadFile({
  276. url: mainUrl + '/api/File',
  277. filePath: e,
  278. name: 'File',
  279. fileType: 'image',
  280. header: {
  281. "User-Agent": "apifox/1.0.0 (https://www.apifox.cn)"
  282. },
  283. formData: {
  284. File: JSON.stringify(e),
  285. // file_name: fileName,
  286. },
  287. success(re) {
  288. uni.hideLoading()
  289. let res = JSON.parse(re.data)
  290. if (res.code == 200) {
  291. if (i == 1) {
  292. that.form.identifyPics.push(res.data.file)
  293. } else if (i == 2) {
  294. that.form.proxyFile.push(res.data.file)
  295. console.log(that.form.proxyFile);
  296. }
  297. } else {
  298. uni.showModal({
  299. title: '',
  300. content: res.msg,
  301. showCancel: false,
  302. });
  303. }
  304. },
  305. fail(e) {
  306. if (e && e.msg) {
  307. uni.showModal({
  308. title: '错误',
  309. content: e.msg,
  310. showCancel: false,
  311. });
  312. }
  313. },
  314. });
  315. }
  316. }
  317. }
  318. </script>
  319. <style lang="scss" scoped>
  320. .content {
  321. padding: 0 30rpx;
  322. box-sizing: border-box;
  323. }
  324. .headbox {
  325. display: flex;
  326. justify-content: space-between;
  327. align-items: flex-end;
  328. }
  329. .headtitle {
  330. font-size: 60rpx;
  331. font-weight: 600;
  332. padding-bottom: 36rpx;
  333. }
  334. .logobox {
  335. width: 269rpx;
  336. height: 191rpx;
  337. image {
  338. width: 100%;
  339. height: 100%;
  340. }
  341. }
  342. .acountbox {
  343. .upmsg {
  344. // position: relative;
  345. margin-top: 20rpx;
  346. background-color: #F6F6F6;
  347. width: 690rpx;
  348. // height: 399rpx;
  349. border-radius: 20rpx;
  350. display: flex;
  351. flex-direction: column;
  352. align-items: center;
  353. justify-content: center;
  354. // overflow: hidden;
  355. image {
  356. width: 100%;
  357. height: 100%;
  358. }
  359. }
  360. .uppic {
  361. display: flex;
  362. align-items: center;
  363. justify-content: center;
  364. width: 500rpx;
  365. height: 250rpx;
  366. background-image: url("@/static/img/upuer.png");
  367. background-size: 100%;
  368. }
  369. .inacount {
  370. flex: 1;
  371. display: flex;
  372. padding: 35rpx 20rpx;
  373. box-sizing: border-box;
  374. // width: 606rpx;
  375. margin-top: 40rpx;
  376. background-color: #F6F6F6;
  377. border-radius: 20rpx;
  378. font-size: 30rpx;
  379. color: #1F242A;
  380. input {
  381. width: 360rpx;
  382. }
  383. }
  384. .acoutitle {
  385. font-weight: 600;
  386. }
  387. .checkword {
  388. padding-left: 20rpx;
  389. color: #1F242A;
  390. font-size: 30rpx;
  391. }
  392. }
  393. .logininbtn {
  394. box-sizing: border-box;
  395. margin-top: 80rpx;
  396. // width: 606rpx;
  397. border-radius: 20rpx;
  398. background: linear-gradient(to right, #FFE1AD, #D07539);
  399. height: 100rpx;
  400. text-align: center;
  401. color: #fff;
  402. line-height: 100rpx;
  403. }
  404. .acountall {
  405. display: flex;
  406. justify-content: flex-end;
  407. margin-top: 30rpx;
  408. font-size: 24rpx;
  409. }
  410. .checkag {
  411. margin-top: 200rpx;
  412. font-size: 28rpx;
  413. margin-bottom: 150rpx;
  414. }
  415. .img-up {
  416. position: relative;
  417. }
  418. .delet-img {
  419. position: absolute;
  420. top: 0px;
  421. right: 0px;
  422. }
  423. </style>