supplierges.vue 9.8 KB

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