perfect.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  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" 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="buttonshow?'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. var that=this
  159. for(var i=0;i<this.Persons.length;i++){
  160. if(this.Persons[i].contacts.length<2||this.Persons[i].contacts.length>10){
  161. this.$api.msg('联系人姓名2-10个字')
  162. return
  163. }
  164. if(this.Persons[i].contactsPhone.length<2||this.Persons[i].contactsPhone.length>15){
  165. this.$api.msg('联系人电话7-15位数字')
  166. return
  167. }
  168. }
  169. if(!re.test(this.deptList.email)){
  170. this.$api.msg('邮箱输入错误')
  171. return
  172. }
  173. if(this.deptList.fax.length<6||this.deptList.fax.length>20){
  174. this.$api.msg('传真输入错误')
  175. return
  176. }
  177. this.deptList.label=this.label.toString()
  178. this.deptList.sitePhotoAddress=this.imgList.toString()
  179. this.deptList.settledCompanyContacts=this.Persons
  180. uni.showModal({
  181. content: "详细的企业信息有助于客户了解您的企业,是否确定提交?",
  182. showCancel: true,
  183. confirmText: '提交',
  184. success: function(res) {
  185. if (res.confirm) {
  186. that.$api.doRequest('post', '/settledCompanyInfo/api/addSettledCompanyInfo', that.deptList).then(res => {
  187. if (res.data.code == 200) {
  188. var data={
  189. compName:'',
  190. title:'',
  191. mainBusinessType:'',
  192. companyProfile:'',
  193. }
  194. that.$store.commit('enterchange',data)
  195. uni.switchTab({
  196. url:'/pages/grain_pulse/home'
  197. })
  198. }else{
  199. this.$api.msg(res.data.message)
  200. }
  201. })
  202. }
  203. }
  204. })
  205. }
  206. }
  207. }
  208. }
  209. </script>
  210. <style lang="scss" scoped>
  211. .center {
  212. padding: 10rpx 20rpx;
  213. }
  214. .label{
  215. padding-right:30px;
  216. border:none;
  217. }
  218. .title {
  219. margin-left: 20rpx;
  220. color: #333333;
  221. line-height: 70rpx;
  222. }
  223. .write {
  224. margin-right: 20px;
  225. color: #71747C;
  226. }
  227. .modular {
  228. background-color: #FFFFFF;
  229. border-radius: 12px;
  230. margin-top: 10px;
  231. }
  232. .areaText {
  233. width: 83%;
  234. padding: 30rpx;
  235. border: 2rpx solid #F9F9FA;
  236. background-color: #F9F9FA;
  237. margin: 10rpx auto 20rpx;
  238. border-radius: 20rpx;
  239. color: #AFB3BF;
  240. font-size: 28rpx;
  241. }
  242. .add {
  243. padding: 15rpx 30rpx;
  244. width: 120rpx;
  245. height: 65rpx;
  246. text-align: center;
  247. margin-left: 24rpx;
  248. font-size: 30rpx;
  249. font-weight: 600;
  250. margin-bottom: 10rpx;
  251. border:1px solid #DCDDDC;
  252. }
  253. .forLists {
  254. margin-bottom: 10rpx;
  255. }
  256. .forList {
  257. height: 64rpx;
  258. background-color: #F4FAF8;
  259. padding: 20rpx 30rpx;
  260. color: #22C572;
  261. margin-left: 24rpx;
  262. text-align: center;
  263. }
  264. .addinput {
  265. width: 70%;
  266. margin: 20rpx auto;
  267. border-radius: 50rpx;
  268. }
  269. .addlabel{
  270. background:#F6F6F6;
  271. position:relative;
  272. border-radius: 50rpx;height: 70rpx;font-size: 10px;
  273. padding-right:40px;
  274. line-height: 52rpx;
  275. margin-bottom:10px;
  276. }
  277. .inputOk {
  278. width: 100rpx;
  279. border-radius: 40rpx;
  280. background-color: #E9EAE9;
  281. color: #FFFFFF;
  282. height:70rpx;
  283. border: none;
  284. position:absolute;
  285. right:0;
  286. }
  287. .picture {
  288. width: 144rpx;
  289. height: 144rpx;
  290. border: 4rpx dashed #AFB3BF;
  291. }
  292. .upload {
  293. text-align: center;
  294. margin: 0px 0;
  295. margin-bottom: 10px;
  296. }
  297. .addPerson {
  298. width: 230rpx;
  299. height: 80rpx;
  300. line-height: 80rpx;
  301. text-align: center;
  302. border: 2rpx solid #979797;
  303. border-radius: 40rpx;
  304. margin: 20rpx auto 20rpx;
  305. }
  306. .information {
  307. background-color: #F4FAF8;
  308. width: 96%;
  309. height: 180rpx;
  310. margin: 0 auto;
  311. border: 1rpx dashed #22C572;
  312. border-radius: 10rpx;
  313. margin-top: 30rpx;
  314. }
  315. .xinxi {
  316. margin-left: 70rpx;
  317. }
  318. .del {
  319. justify-content: flex-end;
  320. margin: 10rpx 20rpx 0 0;
  321. }
  322. </style>