perfect.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355
  1. <template>
  2. <view class="center">
  3. <u-form>
  4. <view class="modular">
  5. <u-form-item label="公司名称" label-width="30%" class="title Medium" :border-bottom="topBorder">
  6. <view style='width:100%;text-align:right;margin-right:10px;'>{{deptList.compName}}</view>
  7. </u-form-item>
  8. </view>
  9. <view style='padding-bottom:10px;' class="modular">
  10. <view class="title Medium">企业概况</view>
  11. <!-- <u-input v-model="value" :type="type" :height="height" :auto-height="autoHeight" placeholder="请输入企业概况,如经营项目、产品类型、企业规模等,不超过300个字" /> -->
  12. <textarea value="" placeholder="请输入企业概况,如经营项目、产品类型、企业规模等,不超过300个字" class="areaText Regular"
  13. v-model="deptList.companyContant" placeholder-style="color:#AFB3BF"/>
  14. <view class="title Regular">添加标签(标签应突出企业特色,最多6个)</view>
  15. <view style='flex-wrap:wrap;width: 100%;' class="flex ">
  16. <view class="forLists" v-for="(item,index) in label" :Key="index">
  17. <u-tag :text="item" mode="dark" class="forList Medium" shape="circle" :show="show"
  18. :closeable="closeable" color="#22C572" @close="closeForList(index)" />
  19. </view>
  20. </view>
  21. <u-tag v-if='label.length<6' text="+" mode="plain" shape="circle" :show="show1" color="#2E2E2D" bg-color="#FFFFFF"
  22. border-color="#F9F9FA" class="add" @click="add"></u-tag>
  23. <view class="addinput addlabel flex" v-if="inputShow">
  24. <u-input class='label' v-model="value" type="type" border focus v-if="inputShow"
  25. placeholder="请输入标签内容,不超过6个字" />
  26. <u-button :type="types" class="inputOk" :class="{active:value.length>0}" shape="circle" @click="addinput">确定</u-button>
  27. </view>
  28. </view>
  29. <view style='padding-bottom:10px;' class="modular">
  30. <view class="title Regular">场地照片(图片清晰,最多9张)</view>
  31. <upload class="upload" ref="upload" :action="action" :max-count="9"
  32. :size-type="['compressed']" @on-success="getImgUrl" @on-remove="onRemove"
  33. @on-uploaded="isAdd = true" ></upload>
  34. </view>
  35. <view style='padding-bottom:10px;' class="modular">
  36. <view class="title Medium">联系方式</view>
  37. <view v-for="(item,index) in Persons">
  38. <view class="information flex">
  39. <view class="xinxi">
  40. <u-form-item label="姓名" label-width="30%" class="Regular" label-position="top"
  41. style="font-size: 28rpx; color: #71747C;" :border-bottom="topBorder">
  42. <u-input v-model="item.contacts" class="Regular" placeholder="请输入姓名" />
  43. </u-form-item>
  44. </view>
  45. <view class="xinxi">
  46. <u-form-item label="电话" label-width="30%" class="Regular" label-position="top"
  47. style="font-size: 28rpx; color: #71747C;" :border-bottom="topBorder">
  48. <u-input maxlength="15" type="digit" v-model="item.contactsPhone" class="Regular" placeholder="请输入电话" />
  49. </u-form-item>
  50. </view>
  51. <div class="del" @click="delPerson(index)">
  52. <span style="font-size: 46rpx; color: #22C572;">×</span>
  53. </div>
  54. </view>
  55. </view>
  56. <view class="addPerson" @click="addPerson">
  57. <image src="../../static/img/liangmai/jia@3x.png" mode=""
  58. style="width: 26rpx;height: 26rpx;top: 2rpx;"></image>
  59. 添加联系人
  60. </view>
  61. </view>
  62. <view class="modular">
  63. <u-form-item label="邮箱" label-width="30%" class="title Regular">
  64. <u-input v-model="deptList.email" input-align="right" class="write Regular" placeholder="请输入电子邮箱" />
  65. </u-form-item>
  66. <u-form-item label="传真" label-width="30%" class="title Regular" :border-bottom="topBorder">
  67. <u-input v-model="deptList.fax" input-align="right" class="write Regular" placeholder="请输入传真号" />
  68. </u-form-item>
  69. </view>
  70. </u-form>
  71. <u-button type="success" shape="circle" style="margin-top: 20rpx;" @click="submit">提交</u-button>
  72. </view>
  73. </template>
  74. <script>
  75. import upload from '@/components/upload.vue';
  76. export default {
  77. components: {
  78. upload
  79. },
  80. data() {
  81. return {
  82. deptList: {},
  83. label: [],
  84. closeable: true,
  85. show: true,
  86. show1: true,
  87. types: "",
  88. inputShow: false,
  89. value: "", //临时标签内容字段 后期更换
  90. action: 'https://www.zthymaoyi.com/upload/admin',
  91. fileList: [],
  92. imgList: [],
  93. Persons: [{contacts:'',contactsPhone:''}],
  94. topBorder: false,
  95. }
  96. },
  97. onLoad(options) {
  98. if(options.deptList){
  99. this.deptList=JSON.parse(options.deptList)
  100. console.log(this.deptList)
  101. }
  102. },
  103. computed: {
  104. // buttonshow(){
  105. // if(!this.deptList.companyContant&&this.label.length==0&&this.imgList.length==0&&!this.deptList.email&&!this.deptList.fax){
  106. // return false
  107. // }else{
  108. // return true
  109. // }
  110. // }
  111. },
  112. methods: {
  113. add() {
  114. if (this.label.length >= 6) {
  115. this.inputShow = false
  116. } else {
  117. this.inputShow = true
  118. }
  119. },
  120. getImgUrl(res) {
  121. console.log(res)
  122. this.imgList.push(res);
  123. },
  124. addinput() {
  125. if (!this.value) {
  126. this.$api.msg('标签内容不能为空')
  127. return
  128. }
  129. if (this.value.length < 2 || this.value.length > 6) {
  130. this.$api.msg('标签内容输入有误')
  131. return
  132. }
  133. this.label.push(this.value)
  134. this.value = ""
  135. this.inputShow = false
  136. },
  137. addPerson() {
  138. this.Persons.push({
  139. name: "",
  140. phone: "",
  141. })
  142. },
  143. delPerson(index) {
  144. this.Persons.splice(index, 1)
  145. },
  146. closeForList(index) {
  147. this.label.splice(index, 1)
  148. },
  149. onRemove(e) {
  150. this.imgList.splice(e, 1)
  151. },
  152. uploadSuccess(e) {
  153. this.imgList.push(e.url)
  154. },
  155. submit() {
  156. // let re = /^\w+@[a-zA-Z0-9]{2,10}(?:\.[a-z]{2,4}){1,3}$/;
  157. // if(this.buttonshow){
  158. // }
  159. var that=this
  160. for(var i=0;i<this.Persons.length;i++){
  161. if(this.Persons[i].contacts.length<2||this.Persons[i].contacts.length>10){
  162. this.$api.msg('联系人姓名2-10个字')
  163. return
  164. }
  165. if(this.Persons[i].contactsPhone.length<2||this.Persons[i].contactsPhone.length>15){
  166. this.$api.msg('联系人电话7-15位数字')
  167. return
  168. }
  169. }
  170. // if(!re.test(this.deptList.email)){
  171. // this.$api.msg('邮箱输入错误')
  172. // return
  173. // }
  174. // if(this.deptList.fax.length<6||this.deptList.fax.length>20){
  175. // this.$api.msg('传真输入错误')
  176. // return
  177. // }
  178. this.deptList.label=this.label.toString()
  179. this.deptList.sitePhotoAddress=this.imgList.toString()
  180. this.deptList.settledCompanyContacts=this.Persons
  181. uni.showModal({
  182. content: "详细的企业信息有助于客户了解您的企业,是否确定提交?",
  183. showCancel: true,
  184. confirmText: '提交',
  185. success: function(res) {
  186. if (res.confirm) {
  187. uni.showLoading({
  188. title:"正在提交"
  189. })
  190. that.$api.doRequest('post', '/settledCompanyInfo/api/editSettledCompanyInfo', that.deptList).then(res => {
  191. if (res.data.code == 200) {
  192. var data={
  193. compName:'',
  194. title:'',
  195. mainBusinessType:'',
  196. companyProfile:'',
  197. }
  198. that.$store.commit('enterchange',data)
  199. uni.navigateBack({
  200. delta:2
  201. })
  202. }else{
  203. this.$api.msg(res.data.message)
  204. }
  205. uni.hideLoading()
  206. })
  207. .catch(res => {
  208. console.log("系统异常",res)
  209. uni.hideLoading()
  210. uni.showToast({
  211. title: "系统异常,请联系管理员",
  212. icon: 'none',
  213. duration: 2000
  214. })
  215. })
  216. }
  217. }
  218. })
  219. }
  220. }
  221. }
  222. </script>
  223. <style lang="scss" scoped>
  224. .center {
  225. padding: 10rpx 20rpx;
  226. }
  227. .label{
  228. padding-right:30px;
  229. border:none;
  230. }
  231. .title {
  232. margin-left: 20rpx;
  233. color: #333333;
  234. line-height: 70rpx;
  235. }
  236. .write {
  237. margin-right: 20px;
  238. color: #71747C;
  239. }
  240. .modular {
  241. background-color: #FFFFFF;
  242. border-radius: 12px;
  243. margin-top: 10px;
  244. }
  245. .areaText {
  246. width: 83%;
  247. padding: 30rpx;
  248. border: 2rpx solid #F9F9FA;
  249. background-color: #F9F9FA;
  250. margin: 10rpx auto 20rpx;
  251. border-radius: 20rpx;
  252. color: #AFB3BF;
  253. font-size: 28rpx;
  254. }
  255. .add {
  256. padding: 15rpx 30rpx;
  257. width: 120rpx;
  258. height: 65rpx;
  259. text-align: center;
  260. margin-left: 24rpx;
  261. font-size: 30rpx;
  262. font-weight: 600;
  263. margin-bottom: 10rpx;
  264. border:1px solid #DCDDDC;
  265. }
  266. .forLists {
  267. margin-bottom: 10rpx;
  268. }
  269. .forList {
  270. height: 64rpx;
  271. background-color: #F4FAF8;
  272. padding: 20rpx 30rpx;
  273. color: #22C572;
  274. margin-left: 24rpx;
  275. text-align: center;
  276. }
  277. .addinput {
  278. width: 70%;
  279. margin: 20rpx auto;
  280. border-radius: 50rpx;
  281. }
  282. .addlabel{
  283. background:#F6F6F6;
  284. position:relative;
  285. border-radius: 50rpx;height: 70rpx;font-size: 10px;
  286. padding-right:40px;
  287. line-height: 52rpx;
  288. margin-bottom:10px;
  289. }
  290. .inputOk.active{
  291. background:#22C572;
  292. }
  293. .inputOk {
  294. width: 100rpx;
  295. border-radius: 40rpx;
  296. background-color: #E9EAE9;
  297. color: #FFFFFF;
  298. height:70rpx;
  299. border: none;
  300. position:absolute;
  301. right:0;
  302. }
  303. .picture {
  304. width: 144rpx;
  305. height: 144rpx;
  306. border: 4rpx dashed #AFB3BF;
  307. }
  308. .upload {
  309. text-align: center;
  310. margin: 0px 0;
  311. margin-bottom: 10px;
  312. }
  313. .addPerson {
  314. width: 230rpx;
  315. height: 80rpx;
  316. line-height: 80rpx;
  317. text-align: center;
  318. border: 2rpx solid #979797;
  319. border-radius: 40rpx;
  320. margin: 20rpx auto 20rpx;
  321. }
  322. .information {
  323. background-color: #F4FAF8;
  324. width: 96%;
  325. height: 180rpx;
  326. margin: 0 auto;
  327. border: 1rpx dashed #22C572;
  328. border-radius: 10rpx;
  329. margin-top: 30rpx;
  330. }
  331. .xinxi {
  332. margin-left: 70rpx;
  333. }
  334. .del {
  335. justify-content: flex-end;
  336. margin: 10rpx 20rpx 0 0;
  337. }
  338. </style>