addShare.vue 26 KB

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