circle.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764
  1. <template>
  2. <view class="template-edit tn-safe-area-inset-bottom" style="background: #f7f7f7;min-height: 100vh;">
  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" :disabled="!canSave" plain="true" style="margin-right: 4px;border-radius: 8px;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>
  14. <button v-if="canSave" plain="true" :disabled="!canSave" style="margin-right: 4px;border-radius: 8px;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>
  15. </view>
  16. </view>
  17. </tn-nav-bar>
  18. <view class="tn-safe-area-inset-bottom" :style="{paddingTop: vuex_custom_bar_height + 'px'}">
  19. <view style="display: flex;padding: 16px 80px;">
  20. <view style="position: relative;">
  21. <image style="width: 48px;height: 48px;margin-right: 8px;" src="../static/tu/step1.png"></image>
  22. <view style="position: absolute;width: max-content;margin-left: -8px;" :style="{color:stepIndex==1?'#333':'#777'}">填写需求</view>
  23. </view>
  24. <view style="flex:1;height: 0px;border: 1px dashed #005DA6;align-self: center;"></view>
  25. <view style="position: relative;">
  26. <image v-if="stepIndex==1" style="width: 48px;height: 48px;margin-left: 8px;" src="../static/tu/step2.png"></image>
  27. <image v-if="stepIndex==2" style="width: 48px;height: 48px;margin-left: 8px;" src="../static/tu/step22.png"></image>
  28. <view style="position: absolute;width: max-content;margin-left: -25%;" :style="{color:stepIndex==1?'#777':'#333'}">填写联系方式</view>
  29. </view>
  30. </view>
  31. <!-- <tn-steps style="pointer-events:none;" :list="stepList" :current="stepIndex" mode="dotIcon" :fontSize="(wxFontSize-3)+'px'"></tn-steps>
  32. -->
  33. <view v-show="stepIndex==1">
  34. <view style="margin-top: 24px;background: #e187301a;border-radius: 5px 5px 5px 5px;margin-left: 16px;margin-right: 16px;padding: 8px 0 7px 10px;">
  35. <image src="../static/tu/tip.png" style="width: 20px;height: 20px;vertical-align: bottom;"></image>
  36. <text style="color:#E18730">以下三种方式可任选其一,若有可都输入</text>
  37. </view>
  38. <!-- <view class="tn-flex tn-flex-row-between tn-flex-col-center tn-padding-top tn-margin">
  39. <view class="tn-flex justify-content-item">
  40. <view class="tn-text-lg tn-padding-right-xs tn-text-bold" style="font-size: 16px;" :style="{fontSize:(wxFontSize-1)+'px'}">以下三种方式可任选其一,若有可都输入</view>
  41. </view>
  42. </view> -->
  43. <view style="padding: 16px;color:#333;font-weight: bold;padding-bottom: 8px;" :style="{fontSize:(wxFontSize-1)+'px'}">
  44. 需求
  45. </view>
  46. <view class="tn-margin tn-padding" style="border-radius: 10rpx;background: #fff;margin-top: 0;">
  47. <textarea maxlength="500" v-model="content" placeholder="请描述您的需求..." :style="{fontSize:(wxFontSize-3)+'px',width:'100%'}" :placeholder-style="styleString"></textarea>
  48. </view>
  49. <view style="padding: 16px;color:#333;padding-top: 8px;padding-bottom: 8px;font-weight: bold;" :style="{fontSize:(wxFontSize-1)+'px'}">
  50. 上传图片
  51. </view>
  52. <view class="tn-margin-left tn-padding-top-xs">
  53. <uni-file-picker
  54. v-model="imgList" :limit="6" @delete="deleteFile" :auto-upload="false" @select="select" @success="success">
  55. </uni-file-picker>
  56. <view style="margin-top: 8px;">
  57. <image src="../static/tu/help.png" style="width: 16px;height: 16px;margin-right:4px;vertical-align: bottom;"></image>
  58. <text style="color: #aaa;font-size: 12px;" :style="{fontSize:(wxFontSize-5)+'px'}">一次只能上传<text style="color: #E18730;display: inline;">六张图片</text></text>
  59. </view>
  60. </view>
  61. <view style="padding: 16px;color:#333;font-weight: bold;padding-top: 24px;padding-bottom: 8px;" :style="{fontSize:(wxFontSize-1)+'px'}">
  62. 上传文件
  63. </view>
  64. <!-- <view class="tn-flex tn-flex-row-between tn-flex-col-center tn-padding-top-xl tn-margin" style="margin-bottom: 0;">
  65. <view class="tn-flex justify-content-item">
  66. <view class=" tn-text-center"
  67. style="border-radius: 100rpx;margin-right: 8rpx;width: 45rpx;height: 45rpx;line-height: 45rpx;">
  68. <text class="tn-icon-link" style="font-size: 20px;" :style="{fontSize:(wxFontSize+3)+'px'}"></text>
  69. </view>
  70. <view class="tn-padding-right-xs tn-text-bold" style="font-size: 16px;" :style="{fontSize:(wxFontSize-1)+'px'}">上传文件</view>
  71. </view>
  72. </view> -->
  73. <view style="background: #fff;margin-left: 16px;margin-right: 16px;padding: 12px;border-radius: 6px;">
  74. <uni-file-picker
  75. v-model="fileList" :limit="3" mode="grid" @delete="deleteFile" file-mediatype="all" file-extname="pdf,docx,doc,xls,xlsx" :auto-upload="false" @select="select" @success="success">
  76. <!-- <button size="default">上传文件</button> -->
  77. <view style="text-align: left;">
  78. <button size="mini" style="color:#fff;background-color:#005DA6;border: none;" plain="true" :style="{fontSize:(wxFontSize-5)+'px'}">
  79. <image src="../static/tu/up.png" style="width: 20px;height: 20px;vertical-align: middle;margin-right: 4px;"></image>
  80. 上传文件</button>
  81. </view>
  82. <!-- <tn-button shadow shape="round" fontColor="tn-color-white" size="lg" backgroundColor="tn-bg-blue" :fontSize="24" height="auto" padding="20rpx 36rpx">上传文件</tn-button>
  83. -->
  84. </uni-file-picker>
  85. <view style="margin-top: 4px;">
  86. <text style="color: #999;font-size: 12px;" :style="{fontSize:(wxFontSize-5)+'px'}">一次只能上传<text style="color: #E18730;">三个</text>文件,支持格式<text style="color: #E18730;"> pdf .doc .xls</text>,不超过<text style="color: #E18730;">5MB</text>。</text>
  87. </view>
  88. </view>
  89. <view style="padding: 16px;padding-top:0">
  90. <view style="padding: 16px 0;color:#333;font-weight: bold;" :style="{fontSize:(wxFontSize-1)+'px'}">
  91. 需求有效期
  92. </view>
  93. <uni-data-select
  94. v-model="selectValue"
  95. :localdata="selectList"
  96. @change="changeSelect"
  97. placement="top"
  98. placeholder="请选择"
  99. :fontSize="(wxFontSize-3)+'px'"
  100. ></uni-data-select>
  101. </view>
  102. <!-- 悬浮按钮-->
  103. <view class="tn-flex tn-footerfixed">
  104. <view class="tn-flex-1 justify-content-item tn-margin-sm tn-text-center">
  105. <button type="default" plain="true" style="border-radius: 8px 8px 8px 8px;background: #005DA6;color: #f7f7f7;border: none;" :disabled="!canNext"
  106. @click="nextStep()" :style="{fontSize:(wxFontSize-2)+'px'}">
  107. 下一步
  108. </button>
  109. </view>
  110. </view>
  111. </view>
  112. <view v-show="stepIndex==2">
  113. <view style="padding:16px">
  114. <uni-forms :modelValue="formData" label-width="0">
  115. <view style="margin:16px 0" :style="{fontSize:(wxFontSize-3)+'px'}">
  116. <text style="color: red;line-height: 30px;vertical-align: middle;margin-right: 4px;" >*</text><text>公司名称:</text>
  117. <w-select
  118. style="width: 100%;"
  119. v-model='searchValue'
  120. :list='items'
  121. valueName='name'
  122. keyName="regNumber"
  123. @change='selectChange'
  124. :filterable="true"
  125. :fontSize="(wxFontSize-3)+'px'"
  126. >
  127. </w-select>
  128. </view>
  129. <!-- <uni-forms-item label="公司名称" name="name">
  130. <uni-easyinput type="text" v-model="userInfo.company" placeholder="请输入所在公司名称" />
  131. </uni-forms-item> -->
  132. <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>
  133. <uni-forms-item label="" name="realName" label-width="0">
  134. <uni-easyinput type="text" v-model="formInfo.jobTitle" :inputSize="wxFontSize-3" :placeholder-style="styleString" :clearable="false" placeholder="请输入您的职称" />
  135. </uni-forms-item>
  136. <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>
  137. <uni-forms-item label="联系人姓名" name="contactMethod">
  138. <uni-easyinput type="text" v-model="formInfo.contactPerson" :inputSize="wxFontSize-3" :placeholder-style="styleString" :clearable="false" placeholder="请输入联系人姓名" />
  139. </uni-forms-item>
  140. <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>
  141. <uni-forms-item label="联系方式" name="phone">
  142. <uni-easyinput type="text" v-model="formInfo.contactMethod" :inputSize="wxFontSize-3" :placeholder-style="styleString" :clearable="false" placeholder="请输入联系手机/微信/邮箱" />
  143. </uni-forms-item>
  144. <uni-forms-item label="11" name="check">
  145. <tn-checkbox v-model="formInfo.agree" activeColor="#45c05d" :size="wxFontSize+17" name="选项1">
  146. <text :style="{fontSize:(wxFontSize-4)+'px',color:formInfo.agree?'#45c05d':'#666666'}">同意平台核查所填信息的真实性</text>
  147. </tn-checkbox>
  148. <text :style="{fontSize:(wxFontSize-4)+'px',color:'#888',paddingTop:'8px',display:'block'}">系统将短信通知您审核结果。如需关闭通知功能,请前往我的页面自行关闭</text>
  149. </uni-forms-item>
  150. </uni-forms>
  151. </view>
  152. <view class="tn-flex tn-footerfixed">
  153. <view class="tn-flex-1 justify-content-item tn-margin-sm tn-text-center">
  154. <button type="default" plain="true" style="border-radius: 8px;"
  155. @click="preStep()" :disabled="!canSave" :style="{fontSize:(wxFontSize-2)+'px'}">
  156. 上一步
  157. </button>
  158. </view>
  159. <view class="tn-flex-1 justify-content-item tn-margin-sm tn-text-center">
  160. <button v-if="canSave&&canNext" type="primary" style="background-color:#1d60b1;border-radius: 8px" @click="saveForm()" :style="{fontSize:(wxFontSize-2)+'px'}">提交审核</button>
  161. <button v-if="!canSave||!canNext" type="primary" :disabled="!canSave||!canNext" style="background-color:#0003;border-radius: 8px" @click="saveForm()" :style="{fontSize:(wxFontSize-2)+'px'}">提交审核</button>
  162. </view>
  163. </view>
  164. </view>
  165. </view>
  166. <view class='tn-tabbar-height'></view>
  167. </view>
  168. </template>
  169. <script>
  170. import template_page_mixin from '@/libs/mixin/template_page_mixin.js';
  171. import request from '../utils/request';
  172. export default {
  173. name: 'TemplateEdit',
  174. mixins: [template_page_mixin],
  175. data() {
  176. return {
  177. wxFontSize:17,
  178. canSave: true,
  179. selectValue: '',
  180. //非常紧急/两周/一月/长期
  181. selectList: [{
  182. value: '一周',
  183. text: '一周'
  184. },
  185. {
  186. value: '两周',
  187. text: '两周'
  188. },
  189. {
  190. value: '一月',
  191. text: '一月'
  192. }
  193. ],
  194. content:'',
  195. formInfo:{
  196. jobTitle:'',
  197. agree:false,
  198. contactPerson:JSON.parse(uni.getStorageSync('userInfo')).contactNickName,
  199. contactMethod:JSON.parse(uni.getStorageSync('userInfo')).contactMethod||JSON.parse(uni.getStorageSync('userInfo')).userName
  200. },
  201. imgList:[],
  202. fileDetailList:[],
  203. stepIndex:1,
  204. stepList: [{
  205. name: '填写需求',
  206. icon: 'circle',
  207. selectIcon: 'circle-fill'
  208. },
  209. {
  210. name: '填写联系方式',
  211. icon: 'trusty',
  212. selectIcon: 'trusty-fill'
  213. }
  214. ],
  215. formData: {
  216. apiType: 'this,ali',
  217. token: 'dffc1e06e636cff0fdf7d877b6ae6a2e',
  218. image: null
  219. },
  220. fileList: [],
  221. showUploadList: true,
  222. customBtn: false,
  223. autoUpload: true,
  224. showProgress: false,
  225. deleteable: true,
  226. customStyle: false,
  227. maxCount: 9,
  228. disabled: false,
  229. searchValue: '',
  230. items: [],
  231. org:{
  232. name:'',
  233. regNumber:''
  234. },
  235. editItem:{},
  236. styleString:'font-size:'+14+'px',
  237. canNext:true
  238. }
  239. },
  240. watch: {
  241. searchValue(val, oldval) {
  242. console.error(val,this.org.name);
  243. if(val!==this.org.name){
  244. this.current = null;
  245. }
  246. if(this.stepIndex==2){
  247. this.search(val)
  248. }
  249. }
  250. },
  251. onLoad(props) {
  252. const appBaseInfo = wx.getAppBaseInfo();
  253. this.wxFontSize = uni.getStorageSync('fontSize')||appBaseInfo.fontSizeSetting||17;
  254. this.styleString='font-size:'+(this.wxFontSize-3)+'px';
  255. if(props.sid){
  256. this.isEdit = true;
  257. this.editItem = JSON.parse(uni.getStorageSync(props.sid)||'{}');
  258. this.content = this.editItem.content;
  259. this.fileDetailList = this.editItem.fileDetailList;
  260. for(let i=0;i<this.fileDetailList.length;i++){
  261. this.fileDetailList[i].path = this.fileDetailList[i].ftpUrl
  262. if(this.isImage(this.fileDetailList[i].fileName)){
  263. this.imgList.push({
  264. name: this.fileDetailList[i].fileName,
  265. url: this.fileDetailList[i].ftpUrl,
  266. path: this.fileDetailList[i].path
  267. })
  268. }else{
  269. this.fileList.push({
  270. name: this.fileDetailList[i].fileName,
  271. url: this.fileDetailList[i].ftpUrl,
  272. path: this.fileDetailList[i].path
  273. })
  274. }
  275. }
  276. this.org.name = this.editItem.company;
  277. this.formInfo.jobTitle = this.editItem.jobTitle;
  278. this.formInfo.contactPerson = this.editItem.contactPerson;
  279. this.formInfo.contactMethod = this.editItem.contactMethod;
  280. }
  281. this.getCompany();
  282. },
  283. methods: {
  284. isImage(fileName) {
  285. const imageExtensions = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'ico']
  286. const extension = fileName.split('.').pop().toLowerCase();
  287. return imageExtensions.includes(extension);
  288. },
  289. getCompany(){
  290. let that = this;
  291. request.post('/slbUserCompanyRel/show/my', {
  292. userNo: uni.getStorageSync('userNo')
  293. }).then(res => {
  294. if (res.success) {
  295. let list = res.list || [];
  296. for(let i=0;i<list.length;i++){
  297. list[i].name = list[i].company;
  298. list[i].regNumber= list[i].company;
  299. if(!that.isEdit&&list[i].isDefault=='1'){
  300. that.searchValue = list[i].name
  301. that.current = list[i].name;
  302. that.org = list[i];
  303. if(list[i].jobTitle){
  304. that.formInfo.jobTitle = list[i].jobTitle
  305. }
  306. if(list[i].contactPerson){
  307. that.formInfo.contactPerson = list[i].contactPerson
  308. }
  309. if(list[i].contactMethod){
  310. that.formInfo.contactMethod = list[i].contactMethod;
  311. }
  312. that.getAddress(list[i].name);
  313. }
  314. if(that.isEdit&&list[i].name==that.editItem.company){
  315. that.searchValue = list[i].name
  316. that.current = list[i].name;
  317. that.formInfo.jobTitle = list[i].jobTitle;
  318. that.formInfo.contactPerson = list[i].contactPerson;
  319. that.formInfo.contactMethod = list[i].contactMethod;
  320. that.org = list[i];
  321. that.getAddress(list[i].name);
  322. }
  323. }
  324. that.items = list;
  325. }else{
  326. if(res._redirect){
  327. uni.showToast({
  328. title: '操作过期,请重试',
  329. duration: 2000,
  330. icon:'none'
  331. });
  332. that.goBack();
  333. }
  334. }
  335. })
  336. },
  337. preStep(){
  338. this.stepIndex = 1;
  339. },
  340. nextStep(){
  341. console.warn(this.searchValue);
  342. if(this.content==''&&this.fileDetailList.length===0){
  343. uni.showToast({
  344. title:'请输入您的需求或上传图片/文件',
  345. icon:'none'
  346. })
  347. this.stepIndex = 1;
  348. return false;
  349. }
  350. this.stepIndex = 2;
  351. },
  352. changeSelect(e) {
  353. this.selectValue = e;
  354. },
  355. saveForm(status){
  356. if(!this.canSave){
  357. return false;
  358. }
  359. let that = this;
  360. let params = {
  361. };
  362. if(status!=1&&!this.org.name){
  363. uni.showToast({
  364. title: '请输入公司名称',
  365. duration: 2000,
  366. icon:'none'
  367. });
  368. return false;
  369. }
  370. if(status!=1&&this.formInfo.jobTitle.length<1){
  371. uni.showToast({
  372. title: '请输入您的职称',
  373. duration: 2000,
  374. icon:'none'
  375. });
  376. return false;
  377. }
  378. if(status!=1&&this.formInfo.contactPerson.length<1){
  379. uni.showToast({
  380. title: '请输入联系人姓名',
  381. duration: 2000,
  382. icon:'none'
  383. });
  384. return false;
  385. }
  386. if(status!=1&&this.formInfo.contactMethod.length<1){
  387. uni.showToast({
  388. title: '请输入联系方式',
  389. duration: 2000,
  390. icon:'none'
  391. });
  392. return false;
  393. }
  394. if(status!=1&&!this.formInfo.agree){
  395. uni.showToast({
  396. title: '请勾选同意平台核查所填信息的真实性',
  397. duration: 2000,
  398. icon:'none'
  399. });
  400. return false;
  401. }
  402. if(!that.canNext){
  403. uni.showToast({
  404. title: '照片/文件正在上传中,请耐心等待',
  405. duration: 2000,
  406. icon:'none'
  407. });
  408. return false;
  409. }
  410. uni.showToast({
  411. title: '提交中...',
  412. icon:'none'
  413. });
  414. that.canSave = false;
  415. params.slbResourceDemand = {
  416. type:'3',
  417. company:this.org.name,
  418. jobTitle:this.formInfo.jobTitle,
  419. contactPerson:this.formInfo.contactPerson,
  420. contactMethod:this.formInfo.contactMethod,
  421. content:that.content,
  422. userNo:uni.getStorageSync('userNo'),
  423. validDate:this.selectValue,
  424. status: status==1?status:3,
  425. showFlag:'是',
  426. id: that.isEdit?that.editItem.id:undefined,
  427. bisNo: that.isEdit?that.editItem.bisNo:undefined,
  428. version: that.isEdit?that.editItem.version:undefined
  429. };
  430. params.slbResourceDemand.companyEntity = {};
  431. params.slbResourceDemand.companyEntity.company = params.slbResourceDemand.company;
  432. params.slbResourceDemand.companyEntity.jobTitle = params.slbResourceDemand.jobTitle;
  433. params.slbResourceDemand.companyEntity.creditCode = this.org.creditCode;
  434. params.slbResourceDemand.companyEntity.address = this.org.base;
  435. params.slbResourceDemand.companyEntity.regStatus = this.org.regStatus;
  436. params.slbResourceDemand.companyEntity.contactPerson = params.slbResourceDemand.contactPerson;
  437. params.slbResourceDemand.companyEntity.contactMethod = params.slbResourceDemand.contactMethod;
  438. params.slbResourceDemand.slbUserExt = {
  439. contactPerson:params.slbResourceDemand.contactPerson,
  440. contactMethod:params.slbResourceDemand.contactMethod,
  441. userNo:uni.getStorageSync('userNo'),
  442. };
  443. params.slbResourceDemand = JSON.stringify(params.slbResourceDemand);
  444. // params.slbResourceDemand.companyEntity.contactNickName = params.slbResourceDemand.contactNickName;
  445. // params.slbUserExt = JSON.stringify({
  446. // jobTitle:this.formInfo.jobTitle,
  447. // contactPerson:this.formInfo.contactPerson,
  448. // contactMethod:this.formInfo.contactMethod,
  449. // userNo:uni.getStorageSync('userNo'),
  450. // });
  451. params.fileDetailList = JSON.stringify(this.fileDetailList);
  452. request.post(that.isEdit?'/slbResourceDemand/update':'/slbResourceDemand/add', params).then(res => {
  453. if(res.success){
  454. uni.showToast({
  455. title:status==1?'信息已暂存,请在我的需求中查看暂存信息':'发布已提交,请在我的需求中查看进度',
  456. icon:'none',
  457. success:()=>{
  458. setTimeout(()=>{
  459. uni.redirectTo({
  460. url: "/pages/mine/need?tab="+(status==1?2:1)
  461. });
  462. },1500)
  463. }
  464. })
  465. }else{
  466. uni.showToast({
  467. title:res.msg,
  468. icon:'none'
  469. })
  470. that.canSave = true;
  471. }
  472. console.warn(res);
  473. })
  474. },
  475. // 跳转
  476. tn(e) {
  477. uni.navigateTo({
  478. url: e,
  479. });
  480. },
  481. // 手动上传文件
  482. upload() {
  483. console.warn(121212);
  484. },
  485. // 手动清空列表
  486. clear() {
  487. this.$refs.imageUpload.clear()
  488. },
  489. // 图片拖拽重新排序
  490. onSortList(list) {
  491. console.log(list);
  492. },
  493. select(e) {
  494. console.log('选择文件:', e)
  495. let tempFiles = e.tempFiles;
  496. for (let i in tempFiles) {
  497. this.upfile(tempFiles[i])
  498. }
  499. },
  500. deleteFile(e, index) {
  501. if(!this.canNext){
  502. uni.showToast({
  503. title: '照片/文件正在上传中,请耐心等待',
  504. icon:'none'
  505. });
  506. return false;
  507. }
  508. for(let i=0;i<this.fileDetailList.length;i++){
  509. if(e.tempFile.path===this.fileDetailList[i].path){
  510. this.fileDetailList.splice(i, 1);
  511. }
  512. }
  513. },
  514. upfile(file) {
  515. let that = this;
  516. console.warn(file);
  517. this.canNext = false;
  518. uni.showToast({
  519. title: '照片/文件正在上传中,请耐心等待',
  520. icon:'none'
  521. });
  522. uni.uploadFile({
  523. url: 'https://slb-m.lx-device.com/oss/upload/userFeedback', //仅为示例,非真实的接口地址
  524. filePath: file.url,
  525. name: 'file',
  526. success: (uploadFileRes) => {
  527. that.canNext = true;
  528. uni.hideToast();
  529. console.warn(JSON.parse(uploadFileRes.data));
  530. if(JSON.parse(uploadFileRes.data).success){
  531. let resultMap = JSON.parse(uploadFileRes.data).resultMap;
  532. that.fileDetailList.push({
  533. name: file.name,
  534. fileName: file.name, // 原始文件名
  535. ftpUrl: resultMap.uploadUrl, // 文件访问url
  536. path: file.path
  537. })
  538. }else{
  539. uni.showToast({
  540. title: JSON.parse(uploadFileRes.data).msg+',请删除后重试',
  541. icon:'none'
  542. });
  543. }
  544. },
  545. fail:(err)=>{
  546. uni.showToast({
  547. title: '上传失败,请删除后重试',
  548. icon:'none'
  549. });
  550. }
  551. });
  552. },
  553. // 上传成功
  554. success(e) {
  555. console.log('上传成功')
  556. },
  557. selectChange(e){
  558. console.error(e);
  559. this.searchValue = e.name
  560. this.current = e.regNumber;
  561. if(e.jobTitle){
  562. this.formInfo.jobTitle = e.jobTitle;
  563. }
  564. this.org = e;
  565. this.getAddress(e.name);
  566. },
  567. getAddress(name){
  568. let that = this;
  569. request.post('/member/getEnterPriseInfo', {
  570. keyWord: name
  571. }).then(res => {
  572. if(res&&res.success&&res.resultMap.data){
  573. if( res.resultMap.data.creditCode){
  574. that.org.creditCode = res.resultMap.data.creditCode
  575. }
  576. if( res.resultMap.data.regStatus){
  577. that.org.regStatus = res.resultMap.data.regStatus
  578. }
  579. if( res.resultMap.data.regLocation){
  580. that.org.base = res.resultMap.data.regLocation
  581. }
  582. }
  583. })
  584. },
  585. search: function(val) {
  586. let that = this;
  587. if (val && val.length > 3) {
  588. request.post('/member/searchCompys', {
  589. keyWord: val
  590. }).then(res => {
  591. if(res&&res.success){
  592. let list = res.resultMap.data || [];
  593. that.items = list;
  594. }else{
  595. if(res._redirect){
  596. uni.showToast({
  597. title: '操作过期,请重试',
  598. duration: 2000,
  599. icon:'none'
  600. });
  601. that.goBack();
  602. }
  603. }
  604. })
  605. }else{
  606. that.items = [];
  607. that.org = {};
  608. }
  609. },
  610. goBack() {
  611. const pages = getCurrentPages()
  612. // 有可返回的页面则直接返回,uni.navigateBack 默认返回失败之后会自动刷新页面 ,无法继续返回
  613. if (pages.length > 1) {
  614. uni.navigateBack()
  615. return;
  616. }else{
  617. uni.reLaunch({
  618. url: '/pages/index/index'
  619. })
  620. }
  621. },
  622. }
  623. }
  624. </script>
  625. <style lang="scss" scoped>
  626. .template-edit {}
  627. /* 胶囊*/
  628. .tn-custom-nav-bar__back {
  629. width: 60%;
  630. height: 100%;
  631. position: relative;
  632. display: flex;
  633. justify-content: space-evenly;
  634. align-items: center;
  635. box-sizing: border-box;
  636. // background-color: rgba(0, 0, 0, 0.15);
  637. border-radius: 1000rpx;
  638. border: 1rpx solid rgba(255, 255, 255, 0.5);
  639. // color: #FFFFFF;
  640. font-size: 18px;
  641. .icon {
  642. display: block;
  643. flex: 1;
  644. margin: auto;
  645. text-align: center;
  646. }
  647. &:before {
  648. content: " ";
  649. width: 1rpx;
  650. height: 110%;
  651. position: absolute;
  652. top: 22.5%;
  653. left: 0;
  654. right: 0;
  655. margin: auto;
  656. transform: scale(0.5);
  657. transform-origin: 0 0;
  658. pointer-events: none;
  659. box-sizing: border-box;
  660. opacity: 0.7;
  661. background-color: #FFFFFF;
  662. }
  663. }
  664. /* 底部悬浮按钮 start*/
  665. .tn-tabbar-height {
  666. min-height: 100rpx;
  667. height: calc(120rpx + env(safe-area-inset-bottom) / 2);
  668. }
  669. .tn-footerfixed {
  670. position: fixed;
  671. width: 100%;
  672. bottom: calc(env(safe-area-inset-bottom));
  673. z-index: 1024;
  674. box-shadow: 0 1rpx 6rpx rgba(0, 0, 0, 0);
  675. background: #f7f7f7;
  676. }
  677. /* 底部悬浮按钮 end*/
  678. /* 标签内容 start*/
  679. .tn-tag-content {
  680. &__item {
  681. display: inline-block;
  682. line-height: 45rpx;
  683. padding: 10rpx 30rpx;
  684. margin: 20rpx 20rpx 5rpx 0rpx;
  685. &--prefix {
  686. padding-right: 10rpx;
  687. }
  688. }
  689. }
  690. /deep/ .uni-forms-item__label {
  691. display: none;
  692. }
  693. /deep/ .uni-stat__select .uni-select__input-placeholder {
  694. font-size: 14px;
  695. }
  696. /* 标签内容 end*/
  697. </style>