addShare.vue 32 KB

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