addShare.vue 35 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045
  1. <template>
  2. <view class="template-edit tn-safe-area-inset-bottom">
  3. <!-- 顶部自定义导航 -->
  4. <tn-nav-bar fixed customBack>
  5. <view slot="back" class='tn-custom-nav-bar__back' @click="goBack">
  6. <text class='icon tn-icon-left'></text>
  7. </view>
  8. <view slot="default" style="display: flex;">
  9. <view style="flex:1;margin-left:25px">
  10. <text>发布供应</text>
  11. </view>
  12. <view>
  13. <button plain="true" style="margin-right: 4px;border-radius: 24px;height:32px;line-height: 32px;font-size:15px;margin-top:4px;color:#1d60b1;border-color:#1d60b1;" @click="saveForm(1)">暂存</button>
  14. <!-- <text style="margin-right: 4px;padding: 6px 15px;background-color:#00000026;border-radius: 30px;color: #3D7EFF;" @click="saveForm(1)">暂存</text> -->
  15. </view>
  16. </view>
  17. </tn-nav-bar>
  18. <view class="tn-safe-area-inset-bottom" :style="{paddingTop: vuex_custom_bar_height + 'px'}">
  19. <tn-steps style="pointer-events:none;" :list="selectValue=='个人'?stepList:stepList2" :current="stepIndex" mode="dotIcon"></tn-steps>
  20. <view v-if="stepIndex==1">
  21. <view style="padding: 16px">
  22. <view style="line-height: 30px;">
  23. 发布主体:
  24. <uni-data-checkbox :multiple="false" v-model="selectValue" selectedColor="#01BEFF"
  25. :localdata="[{text: '个人',value: '个人'},{text: '公司',value: '公司'}]" />
  26. </view>
  27. <!-- <uni-data-select v-model="selectValue" :localdata="selectList" @change="changeSelect"
  28. :clear="false"></uni-data-select> -->
  29. </view>
  30. <view v-if="selectValue=='个人'" style="padding: 16px">
  31. <uni-forms :modelValue="formData" label-width="0">
  32. <text style="color: red;line-height: 30px;vertical-align: middle;margin-right: 4px;">*</text><text>用户昵称:</text>
  33. <text class="tn-icon-help" style="color:#999;padding: 4px;" @click="showTips=!showTips"></text>
  34. <uni-forms-item label="用户昵称" name="realName" label-width="0">
  35. <uni-easyinput type="text" disabled v-model="formInfo.contactNickName" placeholder="请输入您的昵称" />
  36. </uni-forms-item>
  37. <text style="line-height: 30px;vertical-align: middle;">真实姓名:</text>
  38. <uni-forms-item label="真实姓名" name="contactMethod" v-if="formInfo.userRealName">
  39. <uni-easyinput type="text" disabled="" v-model="formInfo.userRealName" placeholder="请输入真实姓名" />
  40. </uni-forms-item>
  41. <text style="color: red;line-height: 30px;vertical-align: middle;margin-right: 4px;">*</text><text>联系方式:</text>
  42. <uni-forms-item label="联系方式" name="phone">
  43. <uni-easyinput type="text" disabled v-model="formInfo.contactMethod" placeholder="请输入联系手机/微信/邮箱" />
  44. </uni-forms-item>
  45. </uni-forms>
  46. <text v-if="showTips" style="font-size: 12px;color:#999;">如要更改个人信息,请在我的=><text>个人信息</text>页面更改</text>
  47. </view>
  48. <view v-if="selectValue=='公司'" style="padding: 16px">
  49. <uni-forms :modelValue="formData" label-width="0">
  50. <view style="margin-bottom:16px">
  51. <text style="color: red;line-height: 30px;vertical-align: middle;margin-right: 4px;">*</text><text>公司名称:</text>
  52. <w-select style="width: 100%;" v-model='searchValue' :list='items' valueName='name'
  53. keyName="regNumber" @change='selectChange' :filterable="true">
  54. </w-select>
  55. </view>
  56. <!-- <uni-forms-item label="公司名称" name="name">
  57. <uni-easyinput type="text" v-model="userInfo.company" placeholder="请输入所在公司名称" />
  58. </uni-forms-item> -->
  59. <text style="color: red;line-height: 30px;vertical-align: middle;margin-right: 4px;">*</text><text>您的职称:</text>
  60. <uni-forms-item label="" name="realName" label-width="0">
  61. <uni-easyinput type="text" :clearable="false" v-model="formInfo.jobTitle" placeholder="请输入您的职称" />
  62. </uni-forms-item>
  63. <text style="color: red;line-height: 30px;vertical-align: middle;margin-right: 4px;">*</text><text>联系姓名:</text>
  64. <uni-forms-item label="联系人姓名" name="contactMethod">
  65. <uni-easyinput type="text" :clearable="false" v-model="formInfo.contactPerson" placeholder="请输入联系人姓名" />
  66. </uni-forms-item>
  67. <text style="color: red;line-height: 30px;vertical-align: middle;margin-right: 4px;">*</text><text>联系方式:</text>
  68. <uni-forms-item label="联系方式" name="phone">
  69. <uni-easyinput type="text" :clearable="false" v-model="formInfo.contactMethod" placeholder="请输入联系手机/微信/邮箱" />
  70. </uni-forms-item>
  71. <uni-forms-item label="11" required>
  72. <uni-data-checkbox v-model="formInfo.agree"
  73. localdata="[{text: '同意平台核查所填信息的真实性',value: '是'}]" />
  74. </uni-forms-item>
  75. </uni-forms>
  76. </view>
  77. <!-- <view class="tn-flex tn-flex-row-between tn-flex-col-center tn-padding-top-xl tn-margin">
  78. <view class="tn-flex justify-content-item">
  79. <view class="tn-bg-black tn-color-white tn-text-center" style="border-radius: 100rpx;margin-right: 8rpx;width: 45rpx;height: 45rpx;line-height: 45rpx;">
  80. <text class="tn-icon-tag" style="font-size: 30rpx;"></text>
  81. </view>
  82. <view class="tn-text-lg tn-padding-right-xs tn-text-bold">话题标签</view>
  83. </view>
  84. <view class="justify-content-item tn-text-df tn-color-grey">
  85. <text class="tn-padding-xs">选择</text>
  86. <text class="tn-icon-right"></text>
  87. </view>
  88. </view> -->
  89. <!-- 悬浮按钮-->
  90. <view class="tn-flex tn-footerfixed">
  91. <!-- <view class="tn-flex-1 justify-content-item tn-margin-sm tn-text-center">
  92. <button type="default" plain="true" style="border-radius: 24px;"
  93. @click="preStep()">
  94. 上一步
  95. </button>
  96. </view> -->
  97. <view class="tn-flex-1 justify-content-item tn-margin-sm tn-text-center">
  98. <button type="default" plain="true" style="border-radius: 24px;"
  99. @click="nextStep()">
  100. 下一步
  101. </button>
  102. </view>
  103. </view>
  104. </view>
  105. <view v-if="stepIndex!=1">
  106. <view style="padding: 16px;padding-bottom: 0;" v-if="(selectValue=='公司'&&stepIndex==2)||(selectValue=='个人'&&stepIndex==2)">
  107. <text style="color: red;line-height: 30px;vertical-align: middle;margin-right: 4px;">*</text><text>发布种类:</text>
  108. <uni-data-select v-model="selectValue2" :localdata="selectList2" @change="changeSelect2"
  109. :clear="false"></uni-data-select>
  110. </view>
  111. <view v-if="selectValue2=='产品'" >
  112. <view style="padding: 16px" v-if="(selectValue=='公司'&&stepIndex==2)||(selectValue=='个人'&&stepIndex==2)">
  113. <text style="color: red;line-height: 30px;vertical-align: middle;margin-right: 4px;">*</text><text>产品种类:</text>
  114. <uni-data-select v-model="selectValue4" :localdata="selectList4" @change="changeSelect4"
  115. placeholder="产品种类" :clear="false" style="margin-bottom:16px"></uni-data-select>
  116. <view style="margin-top: 16px;">
  117. <text style="color: red;line-height: 30px;vertical-align: middle;margin-right: 4px;">*</text><text>产品品牌:</text>
  118. <uni-easyinput type="text" :clearable="false" required v-model="brand" placeholder="请输入产品品牌" />
  119. </view>
  120. <view style="margin-top: 16px;line-height: 30px;margin-bottom: 16px;">
  121. <text style="color: red;line-height: 30px;vertical-align: middle;margin-right: 4px;">*</text>发布的产品是否属于医疗器械?
  122. <uni-data-checkbox :multiple="false" v-model="isMedical" selectedColor="#01BEFF"
  123. :localdata="[{text: '是',value: '1'},{text: '否',value: '0'}]" />
  124. </view>
  125. <view v-for="item,itemIndex in extList">
  126. <uni-card >
  127. <template v-slot:title>
  128. <uni-list>
  129. <uni-list-item style="align-items: center;">
  130. <template v-slot:header>
  131. 产品信息{{itemIndex+1}}
  132. </template>
  133. <template v-slot:footer>
  134. <button type="default" style="color:#1d60b1;border-color:#1d60b1;" plain="true" size="mini" v-if="(extList.length>1&&extList.length<6&&itemIndex==extList.length-1)||extList.length==1" @click="newItem">+新增产品</button>
  135. <button type="warn" plain="true" size="mini" v-if="extList.length>1&&itemIndex!==extList.length-1" @click="delItem(itemIndex)">-删除产品</button>
  136. <!-- <tn-button fontColor="tn-color-white" shape="round" backgroundColor="#3668FC" v-if="extList.length==1" @click="newItem">+新增产品</tn-button>
  137. <tn-button fontColor="tn-color-white" shape="round" backgroundColor="#3668FC" v-if="extList.length>1&&extList.length<6&&itemIndex==extList.length-1" @click="newItem">+新增产品</tn-button>
  138. <tn-button fontColor="tn-color-white" shape="round" backgroundColor="#FF000C" v-if="extList.length>1&&itemIndex!==extList.length-1" @click="delItem(itemIndex)">-删除产品</tn-button> -->
  139. </template>
  140. </uni-list-item>
  141. </uni-list>
  142. </template>
  143. <uni-forms :modelValue="formData" label-width="0">
  144. <uni-forms-item label="" name="prodName" label-width="0">
  145. <text style="color: red;line-height: 30px;vertical-align: middle;margin-right: 4px;">*</text><text>产品名称:</text>
  146. <uni-easyinput maxlength="50" type="text" :clearable="false" v-model="item.prodName"
  147. placeholder="请输入产品名称" />
  148. </uni-forms-item>
  149. <uni-forms-item label="" name="prodSpec" label-width="0">
  150. <text style="color: red;line-height: 30px;vertical-align: middle;margin-right: 4px;">*</text><text>产品型号:</text>
  151. <uni-easyinput maxlength="100" type="text" :clearable="false" v-model="item.prodSpec"
  152. placeholder="请输入产品型号" />
  153. </uni-forms-item>
  154. <uni-forms-item label="" name="prodDesc">
  155. <text style="line-height: 30px;vertical-align: middle;">产品介绍:</text>
  156. <uni-easyinput maxlength="500" type="textarea" v-model="item.prodDesc" placeholder="请输入产品介绍" />
  157. </uni-forms-item>
  158. </uni-forms>
  159. <template v-slot:actions v-if="itemIndex==extList.length-1" >
  160. <view style="margin: 12px;margin-top: -12px;">
  161. <text style="color:#999">为保证排版整洁,最多一次上传六个产品哦</text>
  162. </view>
  163. </template>
  164. </uni-card>
  165. <!-- <view>
  166. <uni-forms :modelValue="formData" label-width="0">
  167. <view style="display: flex;justify-content: space-between;">
  168. <view><text class="tn-icon-p" style="font-size: 30rpx;"></text>产品{{itemIndex+1}}</view>
  169. <view><tn-button v-if="extList.length==1" @click="newItem">+新增产品</tn-button>
  170. <tn-button v-if="extList.length>1&&extList.length<6&&itemIndex==extList.length-1" @click="newItem">+新增产品</tn-button>
  171. <tn-button v-if="extList.length>1&&itemIndex!==extList.length-1" @click="delItem(itemIndex)">-删除产品</tn-button></view>
  172. </view>
  173. <uni-forms-item label="" name="prodName" label-width="0">
  174. <uni-easyinput type="text" required v-model="item.prodName"
  175. placeholder="*请输入产品名称" />
  176. </uni-forms-item>
  177. <uni-forms-item label="" name="contactMethod">
  178. <uni-easyinput type="text" required v-model="item.prodSpec"
  179. placeholder="*请输入产品型号" />
  180. </uni-forms-item>
  181. <uni-forms-item label="" name="phone">
  182. <uni-easyinput type="text" v-model="item.prodDesc" placeholder="请输入产品介绍" />
  183. </uni-forms-item>
  184. </uni-forms>
  185. </view> -->
  186. </view>
  187. </view>
  188. </view>
  189. <view v-if="selectValue2=='服务'&&stepIndex==2">
  190. <view style="padding: 16px">
  191. <text style="color: red;line-height: 30px;vertical-align: middle;margin-right: 4px;">*</text><text>服务类型:</text>
  192. <uni-data-select v-model="selectValue3" :localdata="selectList3" @change="changeSelect3"
  193. :clear="false"></uni-data-select>
  194. </view>
  195. </view>
  196. <view v-if="selectValue2=='服务'&&stepIndex==2">
  197. <view style="padding: 16px">
  198. <text style="line-height: 30px;vertical-align: middle;">服务品牌:</text>
  199. <uni-easyinput type="text" :clearable="false" v-model="brand" placeholder="请输入服务品牌" />
  200. </view>
  201. </view>
  202. <view>
  203. <!-- <view class="tn-margin tn-bg-gray--light" style="border-radius: 10rpx;padding: 20rpx 30rpx;">
  204. <input placeholder="写下一句简短的标题" name="input" placeholder-style="color:#AAAAAA" ></input>
  205. </view> -->
  206. <view v-if="selectValue2=='服务'&&stepIndex==2" style="padding: 16px;padding-bottom: 0;margin-bottom: -30rpx;">
  207. <text style="color: red;line-height: 30px;vertical-align: middle;margin-right: 4px;">*</text><text>服务介绍:</text>
  208. </view>
  209. <view v-if="selectValue2=='服务'&&stepIndex==2" class="tn-margin tn-bg-gray--light tn-padding"
  210. style="border-radius: 10rpx;">
  211. <textarea maxlength="500" v-model="content" placeholder="请输入服务介绍"
  212. placeholder-style="color:#AAAAAA"></textarea>
  213. </view>
  214. <view class="tn-flex tn-flex-row-between tn-flex-col-center tn-margin" v-if="stepIndex==3">
  215. <view class="tn-flex justify-content-item">
  216. <view class="tn-text-center"
  217. style="border-radius: 100rpx;margin-right: 8rpx;width: 45rpx;height: 45rpx;line-height: 45rpx;">
  218. <text class="tn-icon-image" style="font-size: 20px;"></text>
  219. </view>
  220. <view class="tn-padding-right-xs tn-text-bold" style="font-size: 16px;">上传图片(选填)</view>
  221. </view>
  222. <!-- <view class="justify-content-item tn-text-df tn-color-grey" @tap="clear">
  223. <text class="tn-padding-xs">清空上传</text>
  224. <text class="tn-icon-delete"></text>
  225. </view> -->
  226. </view>
  227. <view class="tn-margin-left tn-padding-top-xs" v-if="stepIndex==3">
  228. <uni-file-picker v-model="imgList" :limit="6" :auto-upload="false" @select="select"
  229. @success="success" @delete="deleteFile">
  230. </uni-file-picker>
  231. <view style="margin-top: 8px;">
  232. <text style="color: #999;font-size: 12px;">一次只能上传六张图片</text>
  233. </view>
  234. <!-- <tn-image-upload-drag ref="imageUpload" :action="action" :width="236" :height="236" :formData="formData"
  235. :fileList="fileList" :disabled="disabled" :autoUpload="autoUpload" :maxCount="maxCount"
  236. :showUploadList="showUploadList" :showProgress="showProgress" :deleteable="deleteable"
  237. :customBtn="customBtn" @sort-list="onSortList" /> -->
  238. </view>
  239. <view class="tn-flex tn-flex-row-between tn-flex-col-center tn-margin tn-padding-top-xs" style="margin-top:32px" v-if="stepIndex==3">
  240. <view class="tn-flex justify-content-item">
  241. <view class="tn-text-center"
  242. style="border-radius: 100rpx;margin-right: 8rpx;width: 45rpx;height: 45rpx;line-height: 45rpx;">
  243. <text class="tn-icon-link" style="font-size: 20px;"></text>
  244. </view>
  245. <view class="tn-padding-right-xs tn-text-bold" style="font-size: 16px;">上传相关文件(选填)</view>
  246. </view>
  247. <!-- <view class="justify-content-item tn-text-df tn-color-grey" @tap="clear">
  248. <text class="tn-padding-xs">清空上传</text>
  249. <text class="tn-icon-delete"></text>
  250. </view> -->
  251. </view>
  252. <view class="tn-margin-left tn-padding-top-xs" v-if="stepIndex==3">
  253. <uni-file-picker v-model="fileList" :limit="3" mode="grid" file-mediatype="all"
  254. file-extname="pdf,docx,doc,xls,xlsx" :auto-upload="false" @select="select" @success="success" @delete="deleteFile">
  255. <view style="text-align: left;">
  256. <button size="mini" style="color:#1d60b1;border-color:#1d60b1;display: inline-block;" plain="true">上传文件</button>
  257. </view>
  258. </uni-file-picker>
  259. <view style="margin-top: 8px;">
  260. <text style="color: #999;font-size: 12px;">一次只能上传三个文件,支持格式 pdf .doc .xls,不超过5MB。</text>
  261. </view>
  262. <view style="margin-top:6px" v-if="selectValue2=='产品'">
  263. <text style="color: #999;font-size: 12px;">如若产品属于医疗器械,请上传相关资质证明。</text>
  264. </view>
  265. <!-- <tn-image-upload-drag ref="imageUpload" :action="action" :width="236" :height="236" :formData="formData"
  266. :fileList="fileList2" :disabled="disabled" :autoUpload="autoUpload" :maxCount="maxCount"
  267. :showUploadList="showUploadList" :showProgress="showProgress" :deleteable="deleteable"
  268. :customBtn="customBtn" @sort-list="onSortList" /> -->
  269. </view>
  270. </view>
  271. <view label="11" name="check" style="padding:16px;margin-top:20px" v-if="stepIndex==3">
  272. <uni-data-checkbox :multiple="true" v-model="formInfo.agree" selectedColor="#01BEFF"
  273. :localdata="[{text: '同意平台核查所填信息的真实性',value: '是'}]" />
  274. </view>
  275. <!-- 悬浮按钮-->
  276. <view class="tn-flex tn-footerfixed" >
  277. <view class="tn-flex-1 justify-content-item tn-margin-sm tn-text-center">
  278. <button type="default" plain="true" style="border-radius: 24px;"
  279. @click="preStep()">
  280. 上一步
  281. </button>
  282. </view>
  283. <view class="tn-flex-1 justify-content-item tn-margin-sm tn-text-center">
  284. <button type="default" plain="true" style="border-radius: 24px;"
  285. @click="nextStep()">
  286. 下一步
  287. </button>
  288. <!-- <tn-button backgroundColor="#3668FC" padding="40rpx 0" width="60%" shadow fontBold
  289. @click="nextStep()">
  290. <text class="tn-color-white">下一步</text>
  291. </tn-button> -->
  292. </view>
  293. </view>
  294. <view class="tn-flex tn-footerfixed" v-if="(stepIndex==3)">
  295. <view class="tn-flex-1 justify-content-item tn-margin-sm tn-text-center">
  296. <button type="default" plain="true" style="border-radius: 24px;"
  297. @click="preStep()">
  298. 上一步
  299. </button>
  300. </view>
  301. <view class="tn-flex-1 justify-content-item tn-margin-sm tn-text-center">
  302. <button type="primary" style="background-color:#1d60b1;border-radius: 23px" @click="saveForm()">提交审核</button>
  303. <!-- <tn-button backgroundColor="#3668FC" padding="40rpx 0" width="60%" shadow fontBold
  304. @click="saveForm()">
  305. <text class="tn-color-white">提交审核</text>
  306. </tn-button> -->
  307. </view>
  308. </view>
  309. </view>
  310. </view>
  311. <view class='tn-tabbar-height'></view>
  312. </view>
  313. </template>
  314. <script>
  315. import template_page_mixin from '@/libs/mixin/template_page_mixin.js';
  316. import request from '../utils/request';
  317. export default {
  318. name: 'TemplateEdit',
  319. mixins: [template_page_mixin],
  320. data() {
  321. return {
  322. showTips:false,
  323. canSave:true,
  324. isMedical: '1',
  325. content: '',
  326. selectValue: '个人',
  327. selectList: [{
  328. value: '个人',
  329. text: '个人'
  330. },
  331. {
  332. value: '公司',
  333. text: '公司'
  334. }
  335. ],
  336. selectValue2: '产品',
  337. selectList2: [{
  338. value: '产品',
  339. text: '产品'
  340. },
  341. {
  342. value: '服务',
  343. text: '服务'
  344. }
  345. ],
  346. selectValue3: '维修维保',
  347. brand: '',
  348. // 维修维保/改造升级/验证/搬迁/厂房建设/其他
  349. selectList3: [{
  350. value: '维修维保',
  351. text: '维修维保'
  352. },
  353. {
  354. value: '改造升级',
  355. text: '改造升级'
  356. },
  357. {
  358. value: '验证',
  359. text: '验证'
  360. },
  361. {
  362. value: '搬迁',
  363. text: '搬迁'
  364. },
  365. {
  366. value: '厂房建设',
  367. text: '厂房建设'
  368. },
  369. {
  370. value: '其他',
  371. text: '其他'
  372. }
  373. ],
  374. selectValue4: '机械五金',
  375. selectList4: [{
  376. value: '机械五金',
  377. text: '机械五金'
  378. },
  379. {
  380. value: '仪器仪表',
  381. text: '仪器仪表'
  382. },
  383. {
  384. value: '耗材',
  385. text: '耗材'
  386. },
  387. {
  388. value: '其他',
  389. text: '其他'
  390. }
  391. ],
  392. extList: [],
  393. // 机械五金/仪器仪表/耗材/其他
  394. formInfo: {
  395. jobTitle: '',
  396. userRealName:JSON.parse(uni.getStorageSync('userInfo')).userRealName,
  397. // contactPerson:JSON.parse(uni.getStorageSync('userInfo')).contactNickName?JSON.parse(uni.getStorageSync('userInfo')).contactNickName:'用户'+JSON.parse(uni.getStorageInfoSync('userInfo')).userName.splice(-4),
  398. agree: [],
  399. contactNickName: JSON.parse(uni.getStorageSync('userInfo')).contactNickName||'用户'+JSON.parse(uni.getStorageSync('userInfo')).userName.slice(-4),
  400. contactMethod: JSON.parse(uni.getStorageSync('userInfo')).contactMethod || JSON.parse(uni
  401. .getStorageSync('userInfo')).userName
  402. },
  403. imgList: [],
  404. fileDetailList: [],
  405. stepIndex: 1,
  406. stepList: [{
  407. name: '填写个人信息',
  408. icon: 'circle',
  409. selectIcon: 'circle-fill'
  410. },
  411. {
  412. name: '填写供应信息',
  413. icon: 'trusty',
  414. selectIcon: 'trusty-fill'
  415. },
  416. {
  417. name: '上传附件',
  418. icon: 'folder',
  419. selectIcon: 'folder-fill'
  420. }
  421. ],
  422. stepList2 : [{
  423. name: '填写公司信息',
  424. icon: 'circle',
  425. selectIcon: 'circle-fill'
  426. },
  427. {
  428. name: '填写供应信息',
  429. icon: 'trusty',
  430. selectIcon: 'trusty-fill'
  431. },
  432. {
  433. name: '上传附件',
  434. icon: 'folder',
  435. selectIcon: 'folder-fill'
  436. }
  437. ],
  438. action: 'https://www.hualigs.cn/api/upload',
  439. // action: '',
  440. formData: {
  441. apiType: 'this,ali',
  442. token: 'dffc1e06e636cff0fdf7d877b6ae6a2e',
  443. image: null
  444. },
  445. fileList: [],
  446. showUploadList: true,
  447. customBtn: false,
  448. autoUpload: true,
  449. showProgress: false,
  450. deleteable: true,
  451. customStyle: false,
  452. maxCount: 9,
  453. disabled: false,
  454. searchValue: '',
  455. items: [],
  456. org: {},
  457. isEdit:false,
  458. editItem:{}
  459. }
  460. },
  461. watch: {
  462. searchValue(val, oldval) {
  463. console.error(val, this.org.name);
  464. if (val !== this.org.name) {
  465. this.current = null;
  466. }
  467. if(this.selectValue!='个人'){
  468. this.search(val)
  469. }
  470. }
  471. },
  472. onLoad(props) {
  473. //从暂存里面编辑
  474. if(props.sid){
  475. this.isEdit = true;
  476. this.editItem = JSON.parse(uni.getStorageSync(props.sid)||'{}');
  477. this.content = this.editItem.content;
  478. this.selectValue2 = this.editItem.type==1?'产品':'服务';
  479. this.selectValue3 = this.editItem.secType;
  480. this.brand = this.editItem.brand;
  481. this.selectValue = this.editItem.subject=='1'?'公司':'个人';
  482. this.fileDetailList = this.editItem.fileDetailList;
  483. for(let i=0;i<this.fileDetailList.length;i++){
  484. this.fileDetailList[i].path = this.fileDetailList[i].ftpUrl
  485. if(this.isImage(this.fileDetailList[i].fileName)){
  486. this.imgList.push({
  487. name: this.fileDetailList[i].fileName,
  488. url: this.fileDetailList[i].ftpUrl,
  489. path: this.fileDetailList[i].path
  490. })
  491. }else{
  492. this.imgList.push({
  493. name: this.fileDetailList[i].fileName,
  494. url: this.fileDetailList[i].ftpUrl,
  495. path: this.fileDetailList[i].path
  496. })
  497. }
  498. }
  499. if(this.selectValue2=='产品'){
  500. this.selectValue4 = this.editItem.secType;
  501. this.isMedical = this.editItem.isMedical;
  502. this.extList = this.editItem.shareExt;
  503. }
  504. this.org.name = this.editItem.company;
  505. this.formInfo.jobTitle = this.editItem.jobTitle;
  506. this.formInfo.contactPerson = this.editItem.contactPerson;
  507. this.formInfo.contactMethod = this.editItem.contactMethod;
  508. this.formInfo.contactNickName = this.formInfo.contactNickName;
  509. }
  510. this.getCompany();
  511. },
  512. methods: {
  513. showSet(){
  514. uni.navigateTo({
  515. url: '/minePages/set',
  516. });
  517. },
  518. preStep(){
  519. this.stepIndex = this.stepIndex-1;
  520. },
  521. nextStep() {
  522. //todo 检查
  523. let that = this;
  524. if(this.stepIndex==1&&this.extList.length==0){
  525. this.extList.push({
  526. prodDesc: "",
  527. prodName: "",
  528. prodSpec: "",
  529. })
  530. }
  531. if(that.selectValue=='公司'){
  532. console.error(this.org);
  533. //判断必填项
  534. // 公司
  535. if(!this.org.name){
  536. uni.showToast({
  537. title: '请输入公司名称',
  538. duration: 2000,
  539. icon:'none'
  540. });
  541. return false;
  542. }
  543. if(this.formInfo.jobTitle.length<1){
  544. uni.showToast({
  545. title: '请输入您的职称',
  546. duration: 2000,
  547. icon:'none'
  548. });
  549. return false;
  550. }
  551. if(this.formInfo.contactPerson.length<1){
  552. uni.showToast({
  553. title: '请输入联系人姓名',
  554. duration: 2000,
  555. icon:'none'
  556. });
  557. return false;
  558. }
  559. if(this.formInfo.contactMethod.length<1){
  560. uni.showToast({
  561. title: '请输入联系手机/微信/邮箱',
  562. duration: 2000,
  563. icon:'none'
  564. });
  565. return false;
  566. }
  567. }
  568. if(this.stepIndex==2&&that.selectValue2=='产品'){
  569. if(this.brand.length<1){
  570. uni.showToast({
  571. title: '请输入产品品牌',
  572. duration: 2000,
  573. icon:'none'
  574. });
  575. return false;
  576. }
  577. for(let i=0;i<this.extList.length;i++){
  578. if(!this.extList[i].prodName||!this.extList[i].prodSpec){
  579. uni.showToast({
  580. title: !this.extList[i].prodName?'请输入产品'+(i+1)+'的产品名称':'请输入产品'+(i+1)+'的产品型号',
  581. duration: 2000,
  582. icon:'none'
  583. });
  584. return false;
  585. }
  586. }
  587. }
  588. if(this.stepIndex==2&&that.selectValue2=='服务'){
  589. if(!this.content){
  590. uni.showToast({
  591. title: '请输入服务介绍',
  592. duration: 2000,
  593. icon:'none'
  594. });
  595. return false;
  596. }
  597. }
  598. this.stepIndex = this.stepIndex+1;
  599. },
  600. getCompany(){
  601. let that = this;
  602. request.post('/slbUserCompanyRel/show/my', {
  603. userNo: uni.getStorageSync('userNo')
  604. }).then(res => {
  605. if (res.success) {
  606. let list = res.list || [];
  607. for(let i=0;i<list.length;i++){
  608. list[i].name = list[i].company;
  609. list[i].regNumber= list[i].company;
  610. if(!that.isEdit&&list[i].isDefault=='1'){
  611. that.searchValue = list[i].name
  612. that.current = list[i].name;
  613. that.formInfo.jobTitle = list[i].jobTitle;
  614. that.formInfo.contactPerson = list[i].contactPerson;
  615. that.formInfo.contactMethod = list[i].contactMethod;
  616. that.org = list[i];
  617. }
  618. if(that.isEdit&&list[i].name==that.editItem.company){
  619. that.searchValue = list[i].name
  620. that.current = list[i].name;
  621. that.formInfo.jobTitle = list[i].jobTitle;
  622. that.formInfo.contactPerson = list[i].contactPerson;
  623. that.formInfo.contactMethod = list[i].contactMethod;
  624. that.org = list[i];
  625. }
  626. }
  627. that.items = list;
  628. console.warn(that.items);
  629. }
  630. })
  631. },
  632. changeSelect(e) {
  633. this.selectValue = e;
  634. },
  635. changeSelect2(e) {
  636. this.selectValue2 = e;
  637. },
  638. changeSelect3(e) {
  639. this.selectValue3 = e;
  640. },
  641. changeSelect4(e) {
  642. this.selectValue4 = e;
  643. },
  644. newItem(){
  645. this.extList.push({
  646. prodDesc: "",
  647. prodName: "",
  648. prodSpec: "",
  649. })
  650. },
  651. delItem(index){
  652. this.extList.splice(index,1);
  653. },
  654. saveForm(status) {
  655. if(!this.canSave){
  656. return false;
  657. }
  658. let that = this;
  659. if(status!=1&&that.selectValue2=='服务'){
  660. if(!this.content&&this.fileDetailList.length<1){
  661. uni.showToast({
  662. title: '请输入服务介绍或上传图片/文件',
  663. duration: 2000,
  664. icon:'none'
  665. });
  666. return false;
  667. }
  668. }
  669. if(status!=1&&that.selectValue2=='产品'){
  670. for(let i=0;i<this.extList.length;i++){
  671. if(!this.extList[i].prodName||!this.extList[i].prodSpec){
  672. uni.showToast({
  673. title: !this.extList[i].prodName?'请输入产品'+(i+1)+'的产品名称':'请输入产品'+(i+1)+'的产品型号',
  674. duration: 2000,
  675. icon:'none'
  676. });
  677. return false;
  678. }
  679. }
  680. }
  681. if(status!=1&&this.formInfo.agree.length<1){
  682. uni.showToast({
  683. title: '请勾选同意平台核查所填信息的真实性',
  684. duration: 2000,
  685. icon:'none'
  686. });
  687. return false;
  688. }
  689. let params = {
  690. };
  691. let postData = {
  692. type: that.selectValue2=='服务'?'2':'1',
  693. secType: that.selectValue3,
  694. company: that.selectValue=='公司'?this.org.name:'',
  695. subject: that.selectValue=='公司'?'1':'2',
  696. jobTitle: this.formInfo.jobTitle,
  697. contactPerson: this.formInfo.contactPerson,
  698. contactMethod: this.formInfo.contactMethod,
  699. contactNickName: this.formInfo.contactNickName,
  700. content: that.content,
  701. userNo: uni.getStorageSync('userNo'),
  702. status: status==1?status:undefined,
  703. brand: that.brand,
  704. id: that.isEdit?that.editItem.id:undefined,
  705. bisNo: that.isEdit?that.editItem.bisNo:undefined,
  706. version: that.isEdit?that.editItem.version:undefined
  707. }
  708. if(that.selectValue=='公司'){
  709. postData.companyEntity = {};
  710. postData.companyEntity.company = postData.company;
  711. postData.companyEntity.jobTitle = postData.jobTitle;
  712. postData.companyEntity.creditCode = this.org.creditCode;
  713. postData.companyEntity.address = this.org.base;
  714. postData.companyEntity.regStatus = this.org.regStatus;
  715. postData.companyEntity.contactPerson = postData.contactPerson;
  716. postData.companyEntity.contactMethod = postData.contactMethod;
  717. postData.companyEntity.contactNickName = postData.contactNickName;
  718. // postData.companyEntity.address = this.org.creditCode;
  719. // postData.companyEntity.company = postData.company;
  720. postData.slbUserExt = {};
  721. postData.slbUserExt.userContactMethod = postData.contactMethod;
  722. postData.slbUserExt.contactPerson = postData.contactPerson;
  723. postData.slbUserExt.contactMethod = postData.contactMethod;
  724. postData.slbUserExt.contactNickName = postData.contactNickName;
  725. postData.slbUserExt.userRealName = this.formInfo.userRealName;
  726. }else{
  727. postData.slbUserExt = {};
  728. postData.slbUserExt.userContactMethod = postData.contactMethod;
  729. postData.slbUserExt.contactPerson = postData.contactPerson;
  730. postData.slbUserExt.contactMethod = postData.contactMethod;
  731. postData.slbUserExt.contactNickName = postData.contactNickName;
  732. postData.slbUserExt.userRealName = this.formInfo.userRealName;
  733. }
  734. if(postData.type=='1'){
  735. postData.secType = that.selectValue4;
  736. postData.isMedical = that.isMedical;
  737. postData.content = '';
  738. postData.shareExt = that.extList;
  739. }
  740. params.slbResourceShare = JSON.stringify(postData);
  741. params.fileDetailList = JSON.stringify(this.fileDetailList);
  742. uni.showToast({
  743. title: '提交中...',
  744. icon:'none'
  745. });
  746. that.canSave = false;
  747. request.post(that.isEdit?'/slbResourceShare/update':'/slbResourceShare/add', params).then(res => {
  748. that.canSave = true;
  749. if (res.success) {
  750. uni.showToast({
  751. title: status==1?'暂存成功':'发布已提交,请在我的供应中查看进度',
  752. icon: 'none',
  753. success: () => {
  754. setTimeout(() => {
  755. uni.redirectTo({
  756. url: "/pages/mine/share?tab="+(status==1?2:1)
  757. });
  758. }, 2500)
  759. }
  760. })
  761. } else {
  762. uni.showToast({
  763. title: res.msg,
  764. icon: 'none'
  765. })
  766. }
  767. console.warn(res);
  768. })
  769. },
  770. // 跳转
  771. tn(e) {
  772. uni.navigateTo({
  773. url: e,
  774. });
  775. },
  776. // 手动上传文件
  777. upload() {
  778. console.warn(121212);
  779. },
  780. // 手动清空列表
  781. clear() {
  782. this.$refs.imageUpload.clear()
  783. },
  784. // 图片拖拽重新排序
  785. onSortList(list) {
  786. console.log(list);
  787. },
  788. select(e) {
  789. console.log('选择文件:', e)
  790. let tempFiles = e.tempFiles;
  791. for (let i in tempFiles) {
  792. this.upfile(tempFiles[i])
  793. }
  794. },
  795. upfile(file) {
  796. let that = this;
  797. console.warn(file);
  798. uni.uploadFile({
  799. url: 'http://slb-m.dev.ml1993.com/oss/upload/userFeedback', //仅为示例,非真实的接口地址
  800. filePath: file.url,
  801. name: 'file',
  802. success: (uploadFileRes) => {
  803. console.warn(JSON.parse(uploadFileRes.data));
  804. let resultMap = JSON.parse(uploadFileRes.data).resultMap;
  805. that.fileDetailList.push({
  806. name: file.name,
  807. fileName: file.name, // 原始文件名
  808. ftpUrl: resultMap.uploadUrl, // 文件访问url
  809. path: file.path
  810. })
  811. }
  812. });
  813. },
  814. // 上传成功
  815. success(e) {
  816. console.log('上传成功')
  817. },
  818. deleteFile(e, index) {
  819. for(let i=0;i<this.fileDetailList.length;i++){
  820. if(e.tempFile.path===this.fileDetailList[i].path){
  821. this.fileDetailList.splice(i, 1);
  822. }
  823. }
  824. console.error(this.fileDetailList);
  825. },
  826. selectChange(e) {
  827. this.searchValue = e.name
  828. this.current = e.regNumber;
  829. if(e.jobTitle){
  830. this.formInfo.jobTitle = e.jobTitle;
  831. this.formInfo.contactPerson = this[i].contactPerson;
  832. this.formInfo.contactMethod = this[i].contactMethod;
  833. }
  834. this.org = e;
  835. },
  836. search: function(val) {
  837. let that = this;
  838. if (val && val.length > 3) {
  839. request.post('/member/searchCompys', {
  840. keyWord: val
  841. }).then(res => {
  842. if (res.success) {
  843. let list = res.resultMap.data || [];
  844. that.items = list;
  845. } else {
  846. uni.showToast({
  847. title: res.msg,
  848. icon: 'none'
  849. })
  850. }
  851. })
  852. } else {
  853. that.items = [];
  854. that.org = {};
  855. }
  856. },
  857. }
  858. }
  859. </script>
  860. <style lang="scss" scoped>
  861. .template-edit {}
  862. /* 胶囊*/
  863. .tn-custom-nav-bar__back {
  864. width: 60%;
  865. height: 100%;
  866. position: relative;
  867. display: flex;
  868. justify-content: space-evenly;
  869. align-items: center;
  870. box-sizing: border-box;
  871. // background-color: rgba(0, 0, 0, 0.15);
  872. border-radius: 1000rpx;
  873. border: 1rpx solid rgba(255, 255, 255, 0.5);
  874. // color: #FFFFFF;
  875. font-size: 18px;
  876. .icon {
  877. display: block;
  878. flex: 1;
  879. margin: auto;
  880. text-align: center;
  881. }
  882. &:before {
  883. content: " ";
  884. width: 1rpx;
  885. height: 110%;
  886. position: absolute;
  887. top: 22.5%;
  888. left: 0;
  889. right: 0;
  890. margin: auto;
  891. transform: scale(0.5);
  892. transform-origin: 0 0;
  893. pointer-events: none;
  894. box-sizing: border-box;
  895. opacity: 0.7;
  896. background-color: #FFFFFF;
  897. }
  898. }
  899. /* 底部悬浮按钮 start*/
  900. .tn-tabbar-height {
  901. min-height: 100rpx;
  902. height: calc(120rpx + env(safe-area-inset-bottom) / 2);
  903. }
  904. .tn-footerfixed {
  905. position: fixed;
  906. width: 100%;
  907. bottom: calc(env(safe-area-inset-bottom));
  908. z-index: 1024;
  909. box-shadow: 0 1rpx 6rpx rgba(0, 0, 0, 0);
  910. background: #fff;
  911. }
  912. /* 底部悬浮按钮 end*/
  913. /* 标签内容 start*/
  914. .tn-tag-content {
  915. &__item {
  916. display: inline-block;
  917. line-height: 45rpx;
  918. padding: 10rpx 30rpx;
  919. margin: 20rpx 20rpx 5rpx 0rpx;
  920. &--prefix {
  921. padding-right: 10rpx;
  922. }
  923. }
  924. }
  925. /deep/ .uni-forms-item__label {
  926. display: none;
  927. }
  928. /deep/ .uni-list-item__container {
  929. align-items: center;
  930. }
  931. /deep/.uni-card--shadow {
  932. margin:0 !important;
  933. }
  934. /* 标签内容 end*/
  935. </style>