addShare.vue 34 KB

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