addShare.vue 39 KB

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