index.vue 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865
  1. <template>
  2. <div class="app-container">
  3. <el-tabs v-model="step">
  4. <el-tab-pane label="商户信息" name="first"></el-tab-pane>
  5. <el-tab-pane label="商城配置信息" name="second"></el-tab-pane>
  6. <el-tab-pane label="微信配置信息" name="third"></el-tab-pane>
  7. <el-tab-pane label="结算配置信息" name="four"></el-tab-pane>
  8. <el-tab-pane label="移动端二维码" name="five"></el-tab-pane>
  9. </el-tabs>
  10. <div v-show="step == 'first'">
  11. <el-form class="my-form" ref="step1Form" :model="step1Form" label-width="100px" label-position="right">
  12. <el-form-item label="商户账号" prop="account">
  13. <el-input v-model="step1Form.account" disabled></el-input>
  14. </el-form-item>
  15. <el-form-item label="账户昵称" prop="nickName">
  16. <el-input v-model="step1Form.nickName" disabled></el-input>
  17. </el-form-item>
  18. <el-form-item label="小程序名称" prop="appName">
  19. <el-input v-model="step1Form.appName" disabled></el-input>
  20. </el-form-item>
  21. <el-form-item label="负责人" prop="chargePerson">
  22. <el-input v-model="step1Form.chargePerson" disabled></el-input>
  23. </el-form-item>
  24. <el-form-item label="联系电话" prop="phone">
  25. <el-input v-model="step1Form.phone" disabled></el-input>
  26. </el-form-item>
  27. <el-form-item label="电子邮箱" prop="email">
  28. <el-input v-model="step1Form.email" disabled></el-input>
  29. </el-form-item>
  30. <el-form-item label="地址" prop="address">
  31. <el-input v-model="step1Form.address" disabled></el-input>
  32. </el-form-item>
  33. <el-form-item label="登录密码" prop="password">
  34. <el-input v-model="step1Form.password" type="password" disabled></el-input>
  35. <el-button class="reset" @click="handleReset()">重置密码</el-button>
  36. </el-form-item>
  37. <el-form-item label="到期时间" prop="companyExpireTime">
  38. <el-date-picker
  39. v-model="step1Form.companyExpireTime"
  40. type="datetime"
  41. value-format="yyyy-MM-dd HH:mm:ss"
  42. placeholder="选择日期时间">
  43. </el-date-picker>
  44. <el-button type="primary" @click="saveTime()">保存</el-button>
  45. </el-form-item>
  46. <!-- <el-form-item class="tr">
  47. <el-button type="primary" @click="submitStep1Form">保存</el-button>
  48. </el-form-item> -->
  49. </el-form>
  50. </div>
  51. <div v-show="step == 'second'">
  52. <el-form label-width="100px" label-position="right">
  53. <el-upload class="avatar-uploader" :action="baseURL + 'common/upload'" :headers="myHeaders"
  54. :show-file-list="false" :on-success="uploadSuccess" :before-upload="beforeUpload">
  55. </el-upload>
  56. <el-form-item label="主logo" prop="imgUrl">
  57. <div class="images">
  58. <div class="main-img">
  59. <div class="img" v-if="img1_url" @mouseover="img1_hover = true;" @mouseout="img1_hover = false;">
  60. <el-image ref="img1" :src="img1_url" :preview-src-list="[img1_url]" style="width: 120px; height: 120px"
  61. fit="contain"></el-image>
  62. <div class="mask" v-show="img1_hover">
  63. <i class="el-icon-zoom-in" @click="previewImage('img1')"></i>
  64. <i class="el-icon-upload2" @click="uploadImage('img1')"></i>
  65. </div>
  66. </div>
  67. <div class="add" v-else @click="uploadImage('img1')">
  68. <i class="el-icon-plus avatar-uploader-icon"></i>
  69. </div>
  70. </div>
  71. <div class="tmp-img">
  72. <el-image :src="require('@/assets/template/template_1.png')"
  73. :preview-src-list="[require('@/assets/template/template_1.png')]"
  74. style="width: 120px; height: 120px; display: block" fit="contain"></el-image>
  75. <div class="tmp">示例图</div>
  76. </div>
  77. </div>
  78. <div class="tips">
  79. <span>建议尺寸:400*400</span>
  80. </div>
  81. </el-form-item>
  82. <el-form-item label="通用logo" prop="imgUrl">
  83. <div class="images">
  84. <div class="main-img">
  85. <div class="img" v-if="img2_url" @mouseover="img2_hover = true;" @mouseout="img2_hover = false;">
  86. <el-image ref="img2" :src="img2_url" :preview-src-list="[img2_url]" style="width: 120px; height: 120px"
  87. fit="contain"></el-image>
  88. <div class="mask" v-show="img2_hover">
  89. <i class="el-icon-zoom-in" @click="previewImage('img2')"></i>
  90. <i class="el-icon-upload2" @click="uploadImage('img2')"></i>
  91. </div>
  92. </div>
  93. <div class="add" v-else @click="uploadImage('img2')">
  94. <i class="el-icon-plus avatar-uploader-icon"></i>
  95. </div>
  96. </div>
  97. <div class="tmp-img">
  98. <el-image :src="require('@/assets/template/template_2.png')"
  99. :preview-src-list="[require('@/assets/template/template_2.png')]"
  100. style="width: 120px; height: 120px; display: block" fit="contain"></el-image>
  101. <div class="tmp">示例图</div>
  102. </div>
  103. </div>
  104. <div class="tips">
  105. <span>建议尺寸:280*60</span>
  106. </div>
  107. </el-form-item>
  108. <el-form-item label="头像logo" prop="imgUrl">
  109. <div class="images">
  110. <div class="main-img">
  111. <div class="img" v-if="img3_url" @mouseover="img3_hover = true;" @mouseout="img3_hover = false;">
  112. <el-image ref="img3" :src="img3_url" :preview-src-list="[img3_url]" style="width: 120px; height: 120px"
  113. fit="contain"></el-image>
  114. <div class="mask" v-show="img3_hover">
  115. <i class="el-icon-zoom-in" @click="previewImage('img3')"></i>
  116. <i class="el-icon-upload2" @click="uploadImage('img3')"></i>
  117. </div>
  118. </div>
  119. <div class="add" v-else @click="uploadImage('img3')">
  120. <i class="el-icon-plus avatar-uploader-icon"></i>
  121. </div>
  122. </div>
  123. <div class="tmp-img">
  124. <el-image :src="require('@/assets/template/template_3.png')"
  125. :preview-src-list="[require('@/assets/template/template_3.png')]"
  126. style="width: 120px; height: 120px; display: block" fit="contain"></el-image>
  127. <div class="tmp">示例图</div>
  128. </div>
  129. </div>
  130. <div class="tips">
  131. <span>建议尺寸:400*400</span>
  132. </div>
  133. </el-form-item>
  134. </el-form>
  135. </div>
  136. <div v-show="step == 'third'">
  137. <!-- <div class="tips">说明:企微配置是指通过配置企业微信将企微用户和系统打通,实现企业微信用户信息同平台互通,聊天会话信息同步</div> -->
  138. <el-form class="my-form2" ref="step3Form" :model="step3Form" :rules="step3FormRules" label-width="200px"
  139. label-position="right">
  140. <!-- <el-card shadow="never" class="my-card">
  141. <div class="title">1.配置企业ID</div>
  142. <div class="box">指引:进入<el-link type="primary" :underline="false" href="https://element.eleme.io" target="_blank">企业微信</el-link>打开【我的企业】,将企业ID分别复制并填写到下方输入框中</div>
  143. <el-form-item label="企业ID" prop="enterpriseId">
  144. <el-input v-model="step3Form.enterpriseId" autocomplete="off" placeholder="请输入企业ID"></el-input>
  145. </el-form-item>
  146. </el-card>
  147. <el-card shadow="never" class="my-card">
  148. <div class="title">2.配置通讯录密钥(Secret)</div>
  149. <div class="box">进入<el-link type="primary" :underline="false" href="https://element.eleme.io" target="_blank">企业微信</el-link>打开【客户联系】-选择【客户】-展开右侧【API】。将外部联系人Secret复制并填写到下方输入框中。如果外部联系人Secret不更新,请将更新后的外部联系人Secret更新复制更新到下方输入框中。</div>
  150. <el-form-item label="通讯录密钥(Secret)" prop="listSecret">
  151. <el-input v-model="step3Form.listSecret" autocomplete="off" placeholder="请输入通讯录密钥(Secret)"></el-input>
  152. </el-form-item>
  153. <el-divider></el-divider>
  154. <div class="title">配置通讯录同步密钥(Secret)</div>
  155. <div class="box">进入<el-link type="primary" :underline="false" href="https://element.eleme.io" target="_blank">企业微信</el-link>打开【管理工具】-选择【通讯录同步】-获取通讯录同步Secret。将通讯录同步Secret复制并填写到下方输入框中。如果通讯录同步Secret不更新,请将更新后的通讯录同步Secret更新复制更新到下方输入框中。</div>
  156. <el-form-item label="通讯录同步密钥(Secret)" prop="listSyncSecret">
  157. <el-input v-model="step3Form.listSyncSecret" autocomplete="off" placeholder="请输入通讯录同步密钥(Secret)"></el-input>
  158. </el-form-item>
  159. </el-card>
  160. <el-card shadow="never" class="my-card">
  161. <div class="title">3.配置小程序</div>
  162. <div class="box">进入<el-link type="primary" :underline="false" href="https://element.eleme.io" target="_blank">企业微信</el-link>打开【应用管理】-选择【应用】-选择【小程序】-获取小程序AgentiD、小程序Secret。将小程序AgentiD、小程序Secret复制并填写到下方输入框中。</div>
  163. <el-form-item label="小程序(AgentiD)" prop="appAgentId">
  164. <el-input v-model="step3Form.appAgentId" autocomplete="off" placeholder="请输入小程序(AgentiD)"></el-input>
  165. </el-form-item>
  166. <el-form-item label="小程序(Secret)" prop="appSecret">
  167. <el-input v-model="step3Form.appSecret" autocomplete="off" placeholder="请输入小程序(Secret)"></el-input>
  168. </el-form-item>
  169. </el-card> -->
  170. <el-card shadow="never" class="my-card">
  171. <div class="title" style="margin-bottom: 20px;">1.其他基础配置</div>
  172. <el-form-item label="小程序appId" prop="appId">
  173. <el-input v-model="step3Form.appId" autocomplete="off" placeholder="请输入小程序appId"></el-input>
  174. </el-form-item>
  175. <el-form-item label="商户号Id" prop="merchantId">
  176. <el-input v-model="step3Form.merchantId" autocomplete="off" placeholder="请输入商户号Id"></el-input>
  177. </el-form-item>
  178. <el-form-item label="商户号Key" prop="merchantKey">
  179. <el-input v-model="step3Form.merchantKey" autocomplete="off" placeholder="请输入商户号Key"></el-input>
  180. </el-form-item>
  181. <el-form-item label="子appId" prop="childAppId">
  182. <el-input v-model="step3Form.childAppId" autocomplete="off" placeholder="请输入子appId"></el-input>
  183. </el-form-item>
  184. <el-form-item label="子密钥" prop="childKey">
  185. <el-input v-model="step3Form.childKey" autocomplete="off" placeholder="请输入子密钥"></el-input>
  186. </el-form-item>
  187. <el-form-item label="子商户号Id" prop="childMerchantId">
  188. <el-input v-model="step3Form.childMerchantId" autocomplete="off" placeholder="请输入子商户号Id"></el-input>
  189. </el-form-item>
  190. <el-form-item label="微信订阅模版" prop="templateId">
  191. <el-input v-model="step3Form.templateId" autocomplete="off" placeholder="请输入微信订阅模版"></el-input>
  192. </el-form-item>
  193. </el-card>
  194. </el-form>
  195. </div>
  196. <div v-show="step == 'four'">
  197. <el-form ref="step4Form" :model="step4Form" :rules="step4FormRules" label-width="100px" label-position="right">
  198. <h4>说明:将按照T+N天自动把销售订单“待结算”状态转为“可提现”状态,T为订单支付成功的日期。</h4>
  199. <h5>自动结算频率</h5>
  200. <el-form-item label="N等于" prop="dayNum">
  201. <el-input v-model="step4Form.dayNum" style="width: 220px;margin-right: 20px;" autocomplete="off"
  202. placeholder="请输入天数" type="number"></el-input>
  203. 天<span style="color: #EA8000;margin-left: 30px;">将在订单支付成功后T+{{ step4Form.dayNum }}天{{ step4Form.hourTime
  204. }}执行一次</span>
  205. </el-form-item>
  206. <el-form-item label="执行时间" prop="hourTime">
  207. <el-time-picker v-model="step4Form.hourTime" value-format="HH:mm:ss" placeholder="选择执行时间">
  208. </el-time-picker>
  209. </el-form-item>
  210. </el-form>
  211. </div>
  212. <div v-show="step == 'five'">
  213. <el-form label-width="100px" label-position="right">
  214. <el-upload class="avatar-uploader" :action="baseURL + 'common/upload'" :headers="myHeaders"
  215. :show-file-list="false" :on-success="uploadSuccess" :before-upload="beforeUpload">
  216. </el-upload>
  217. <el-form-item label="小程序" prop="imgUrl">
  218. <div class="images">
  219. <div class="main-img">
  220. <div class="img" v-if="qrcode1_url" @mouseover="qrcode1_hover = true;" @mouseout="qrcode1_hover = false;">
  221. <el-image ref="qrcode1" :src="qrcode1_url" :preview-src-list="[qrcode1_url]"
  222. style="width: 120px; height: 120px" fit="contain"></el-image>
  223. <div class="mask" v-show="qrcode1_hover">
  224. <i class="el-icon-zoom-in" @click="previewImage('qrcode1')"></i>
  225. <i class="el-icon-upload2" @click="uploadImage('qrcode1')"></i>
  226. </div>
  227. </div>
  228. <div class="add" v-else @click="uploadImage('qrcode1')">
  229. <i class="el-icon-plus avatar-uploader-icon"></i>
  230. </div>
  231. </div>
  232. </div>
  233. <div class="tips">
  234. <span>建议尺寸:400*400</span>
  235. </div>
  236. </el-form-item>
  237. <el-form-item label="公众号" prop="imgUrl">
  238. <div class="images">
  239. <div class="main-img">
  240. <div class="img" v-if="qrcode2_url" @mouseover="qrcode2_hover = true;" @mouseout="qrcode2_hover = false;">
  241. <el-image ref="qrcode2" :src="qrcode2_url" :preview-src-list="[qrcode2_url]"
  242. style="width: 120px; height: 120px" fit="contain"></el-image>
  243. <div class="mask" v-show="qrcode2_hover">
  244. <i class="el-icon-zoom-in" @click="previewImage('qrcode2')"></i>
  245. <i class="el-icon-upload2" @click="uploadImage('qrcode2')"></i>
  246. </div>
  247. </div>
  248. <div class="add" v-else @click="uploadImage('qrcode2')">
  249. <i class="el-icon-plus avatar-uploader-icon"></i>
  250. </div>
  251. </div>
  252. </div>
  253. <div class="tips">
  254. <span>建议尺寸:400*400</span>
  255. </div>
  256. </el-form-item>
  257. </el-form>
  258. </div>
  259. <div class="page-footer">
  260. <div class="footer" :class="classObj">
  261. <el-button type="primary" @click="submitStep2Form" :loading="formLoading" v-if="step == 'second'">{{ formLoading ?
  262. '保存中 ...' : '保 存' }}</el-button>
  263. <el-button type="primary" @click="submitStep3Form" :loading="formLoading" v-if="step == 'third'">{{ formLoading ?
  264. '保存中 ...' : '保 存' }}</el-button>
  265. <el-button type="primary" @click="submitStep4Form" :loading="formLoading" v-if="step == 'four'">{{ formLoading ?
  266. '保存中 ...' : '保 存' }}</el-button>
  267. <el-button type="primary" @click="submitStep5Form" :loading="formLoading" v-if="step == 'five'">{{ formLoading ?
  268. '保存中 ...' : '保 存' }}</el-button>
  269. <el-popconfirm title="确定关闭吗?" @confirm="goBack" style="margin-left: 10px;">
  270. <el-button slot="reference">关 闭</el-button>
  271. </el-popconfirm>
  272. </div>
  273. </div>
  274. <!-- 重置密码 -->
  275. <el-dialog title="重置密码" :visible.sync="resetFormVisible" :show-close="false" width="40%"
  276. :close-on-click-modal="false">
  277. <el-form ref="resetForm" :model="resetForm" :rules="resetFormRules" label-position="left" label-width="100px">
  278. <el-form-item label="输入新密码" prop="newPassword">
  279. <el-input v-model="resetForm.newPassword" ref="password1" autocomplete="off" placeholder="请输入新密码"
  280. :type="passwordType1"></el-input>
  281. <span class="show-pwd" @click="showPwd(1)">
  282. <svg-icon :icon-class="passwordType1 === 'password' ? 'eye' : 'eye-open'" />
  283. </span>
  284. </el-form-item>
  285. <el-form-item label="确认密码" prop="confirmPassword">
  286. <el-input v-model="resetForm.confirmPassword" ref="password2" autocomplete="off" placeholder="请再次输入新密码"
  287. :type="passwordType2"></el-input>
  288. <span class="show-pwd" @click="showPwd(2)">
  289. <svg-icon :icon-class="passwordType2 === 'password' ? 'eye' : 'eye-open'" />
  290. </span>
  291. </el-form-item>
  292. </el-form>
  293. <div slot="footer" class="dialog-footer">
  294. <el-button @click="cancelResetForm">取 消</el-button>
  295. <el-button type="primary" @click="submitResetForm">确 定</el-button>
  296. </div>
  297. </el-dialog>
  298. </div>
  299. </template>
  300. <script>
  301. import { getToken } from '@/utils/auth'
  302. import { getDetail, resetPassword, editAccount } from "@/api/merchant";
  303. import request from '@/utils/request'
  304. export default {
  305. data() {
  306. var validatePass = (rule, value, callback) => {
  307. if (value === '') {
  308. callback(new Error('请输入登录密码'));
  309. } else if (value.length < 12) {
  310. callback(new Error('密码长度至少12位'));
  311. } else if (/[A-Za-z].*[0-9]|[0-9].*[A-Za-z]/.test(value) == false) {
  312. callback(new Error('密码必须包含数字和字母'));
  313. } else {
  314. if (this.resetForm.confirmPassword !== '') {
  315. this.$refs.resetForm.validateField('confirmPassword');
  316. }
  317. callback();
  318. }
  319. };
  320. var validatePass2 = (rule, value, callback) => {
  321. if (value === '') {
  322. callback(new Error('请再次输入密码'));
  323. } else if (value !== this.resetForm.newPassword) {
  324. callback(new Error('两次输入密码不一致'));
  325. } else {
  326. callback();
  327. }
  328. };
  329. return {
  330. baseURL: process.env.VUE_APP_BASE_API,
  331. myHeaders: { 'x-token': getToken() },
  332. id: null,
  333. companyWechatId: null,
  334. step: 'first',
  335. step1Form: {
  336. account: '', // 账号
  337. nickName: '', // 用户名
  338. appName: '', // 小程序名称
  339. chargePerson: '', // 负责人
  340. phone: '', // 联系电话
  341. email: '', // 电子邮箱
  342. address: '', // 地址
  343. newPassword: '', // 新密码
  344. confirmPassword: '', // 确认密码
  345. companyExpireTime: ''
  346. },
  347. passwordType1: 'password',
  348. passwordType2: 'password',
  349. uploadImageType: null,
  350. img1_url: '',
  351. img1_hover: false,
  352. img2_url: '',
  353. img2_hover: false,
  354. img3_url: '',
  355. img3_hover: false,
  356. qrcode1_url: '',
  357. qrcode1_hover: false,
  358. qrcode2_url: '',
  359. qrcode2_hover: false,
  360. resetFormVisible: false,
  361. resetForm: {
  362. newPassword: '', // 新密码
  363. confirmPassword: '', // 确认密码
  364. },
  365. resetFormRules: {
  366. newPassword: [
  367. { required: true, validator: validatePass, trigger: 'blur' }
  368. ],
  369. confirmPassword: [
  370. { required: true, validator: validatePass2, trigger: 'blur' }
  371. ],
  372. },
  373. step3Form: {
  374. enterpriseId: '',
  375. listSecret: '',
  376. listSyncSecret: '',
  377. appAgentId: '',
  378. appSecret: '',
  379. appId: '',
  380. merchantId: '',
  381. merchantKey: '',
  382. childAppId: '',
  383. childKey: '',
  384. childMerchantId: '',
  385. templateId: '',
  386. },
  387. step3FormRules: {
  388. enterpriseId: [
  389. // { required: true, message: '请输入企业ID', trigger: 'blur' }
  390. ],
  391. listSecret: [
  392. // { required: true, message: '请输入通讯录密钥(Secret)', trigger: 'blur' }
  393. ],
  394. listSyncSecret: [
  395. // { required: true, message: '请输入通讯录同步密钥(Secret)', trigger: 'blur' }
  396. ],
  397. appAgentId: [
  398. // { required: true, message: '请输入小程序(AgentiD)', trigger: 'blur' }
  399. ],
  400. appSecret: [
  401. // { required: true, message: '请输入小程序(Secret)', trigger: 'blur' }
  402. ],
  403. },
  404. step4Form: {
  405. dayNum: '',
  406. hourTime: ''
  407. },
  408. step4FormRules: {
  409. dayNum: [
  410. { required: true, message: '请输入天数', trigger: 'blur' }
  411. ],
  412. hourTime: [
  413. { required: true, message: '请选择执行时间', trigger: 'change' }
  414. ],
  415. },
  416. formLoading: false,
  417. }
  418. },
  419. computed: {
  420. sidebar() {
  421. return this.$store.state.app.sidebar
  422. },
  423. classObj() {
  424. return {
  425. hideSidebar: !this.sidebar.opened,
  426. openSidebar: this.sidebar.opened
  427. }
  428. },
  429. },
  430. created() {
  431. const { id, type } = this.$route.query;
  432. this.id = id;
  433. this.getDetail();
  434. if (type === 1) {
  435. this.step = 'first';
  436. } else if (type === 2) {
  437. this.step = 'second';
  438. } else if (type === 3) {
  439. this.step = 'third';
  440. }
  441. },
  442. methods: {
  443. goBack() {
  444. this.$router.go(-1);
  445. },
  446. // 获取详情
  447. getDetail() {
  448. getDetail({ adminUserId: this.id }).then(res => {
  449. this.step1Form.account = res.data.userName;
  450. this.step1Form.nickName = res.data.nickName;
  451. this.step1Form.appName = res.data.minAppName;
  452. this.step1Form.chargePerson = res.data.linkName;
  453. this.step1Form.phone = res.data.linkPhone;
  454. this.step1Form.email = res.data.email;
  455. this.step1Form.address = res.data.address;
  456. this.step1Form.password = '************';
  457. this.step1Form.companyExpireTime = res.data.companyExpireTime
  458. this.img1_url = res.data.minLogo1;
  459. this.img2_url = res.data.minLogo2;
  460. this.img3_url = res.data.minLogo3;
  461. this.qrcode1_url = res.data.qrcode1;
  462. this.qrcode2_url = res.data.qrcode2;
  463. this.step3Form.enterpriseId = res.data.corpId;
  464. this.step3Form.listSecret = res.data.secret2;
  465. this.step3Form.listSyncSecret = res.data.secret3;
  466. this.step3Form.appAgentId = res.data.agentId1;
  467. this.step3Form.appSecret = res.data.secret1;
  468. this.step3Form.appId = res.data.appId;
  469. this.step3Form.merchantId = res.data.mchId;
  470. this.step3Form.merchantKey = res.data.mchKey;
  471. this.step3Form.childAppId = res.data.subAppId;
  472. this.step3Form.childKey = res.data.subSecret;
  473. this.step3Form.childMerchantId = res.data.subMchId;
  474. this.step3Form.templateId = res.data.template;
  475. this.companyWechatId = res.data.companyWechatId;
  476. this.step4Form.dayNum = res.data.dayNum
  477. this.step4Form.hourTime = res.data.hourTime
  478. })
  479. },
  480. // 重置密码
  481. handleReset(id) {
  482. this.resetId = id;
  483. this.resetFormVisible = true;
  484. },
  485. // 取消重置密码
  486. cancelResetForm() {
  487. this.resetFormVisible = false;
  488. this.passwordType1 = 'password';
  489. this.passwordType2 = 'password';
  490. this.$refs.resetForm.resetFields();
  491. },
  492. saveTime(){
  493. request({
  494. url: '/admin/user/user/updateCompanyWechat',
  495. method: 'post',
  496. data: {
  497. expireTime: this.step1Form.companyExpireTime,
  498. companyWechatId: this.companyWechatId
  499. }
  500. }).then(res =>{
  501. if(res.code == 200){
  502. this.$successMsg('保存成功');
  503. this.getDetail()
  504. }
  505. })
  506. },
  507. // 提交重置密码
  508. submitResetForm() {
  509. this.$refs.resetForm.validate((valid) => {
  510. if (valid) {
  511. let params = {
  512. password: this.resetForm.newPassword,
  513. adminUserId: this.id
  514. }
  515. resetPassword(params).then(res => {
  516. this.cancelResetForm();
  517. this.getDetail();
  518. this.$successMsg();
  519. })
  520. }
  521. })
  522. },
  523. // 显示隐藏密码
  524. showPwd(num) {
  525. if (num == 1) {
  526. if (this.passwordType1 === 'password') {
  527. this.passwordType1 = ''
  528. } else {
  529. this.passwordType1 = 'password'
  530. }
  531. this.$nextTick(() => {
  532. this.$refs.password1.focus()
  533. })
  534. }
  535. if (num == 2) {
  536. if (this.passwordType2 === 'password') {
  537. this.passwordType2 = ''
  538. } else {
  539. this.passwordType2 = 'password'
  540. }
  541. this.$nextTick(() => {
  542. this.$refs.password2.focus()
  543. })
  544. }
  545. },
  546. uploadImage(type) {
  547. this.uploadImageType = type;
  548. document.querySelector('.avatar-uploader input').click();
  549. },
  550. // 上传图片
  551. uploadSuccess(res, file) {
  552. this[this.uploadImageType + '_url'] = res.data.url;
  553. },
  554. beforeUpload(file) {
  555. const fileSuffix = file.name.substring(file.name.lastIndexOf(".") + 1);
  556. const whiteList = ['jpg', 'jpeg', 'png'];
  557. if (whiteList.indexOf(fileSuffix) === -1) {
  558. this.$errorMsg('只支持上传jpg/jpeg/png文件!');
  559. return false;
  560. }
  561. },
  562. // 预览图片
  563. previewImage(type) {
  564. this.$refs[type].showViewer = true;
  565. },
  566. submitStep2Form() {
  567. if (!this.img1_url) {
  568. return this.$errorMsg('请上传主logo');
  569. }
  570. if (!this.img2_url) {
  571. return this.$errorMsg('请上传通用logo');
  572. }
  573. if (!this.img3_url) {
  574. return this.$errorMsg('请上传头像logo');
  575. }
  576. this.formLoading = true;
  577. let params = {
  578. adminUserId: this.id,
  579. minLogo1: this.img1_url,
  580. minLogo2: this.img2_url,
  581. minLogo3: this.img3_url,
  582. companyWechatId: this.companyWechatId
  583. }
  584. editAccount(params).then(res => {
  585. this.$successMsg('保存成功');
  586. setTimeout(() => {
  587. this.goBack();
  588. }, 1500)
  589. }).finally(res => {
  590. this.formLoading = false;
  591. })
  592. },
  593. submitStep3Form() {
  594. this.$refs.step3Form.validate((valid) => {
  595. if (valid) {
  596. this.formLoading = true;
  597. let params = {
  598. adminUserId: this.id,
  599. corpId: this.step3Form.enterpriseId,
  600. secret2: this.step3Form.listSecret,
  601. secret3: this.step3Form.listSyncSecret,
  602. agentId1: this.step3Form.appAgentId,
  603. secret1: this.step3Form.appSecret,
  604. appId: this.step3Form.appId,
  605. mchId: this.step3Form.merchantId,
  606. mchKey: this.step3Form.merchantKey,
  607. subAppId: this.step3Form.childAppId,
  608. subSecret: this.step3Form.childKey,
  609. subMchId: this.step3Form.childMerchantId,
  610. template: this.step3Form.templateId,
  611. companyWechatId: this.companyWechatId
  612. }
  613. editAccount(params).then(res => {
  614. this.$successMsg('保存成功');
  615. setTimeout(() => {
  616. this.goBack();
  617. }, 1500)
  618. }).finally(res => {
  619. this.formLoading = false;
  620. })
  621. }
  622. })
  623. },
  624. submitStep4Form() {
  625. this.$refs.step4Form.validate((valid) => {
  626. if (valid) {
  627. this.formLoading = true;
  628. let params = {
  629. adminUserId: this.id,
  630. companyWechatId: this.companyWechatId,
  631. dayNum: this.step4Form.dayNum,
  632. hourTime: this.step4Form.hourTime,
  633. }
  634. editAccount(params).then(res => {
  635. this.$successMsg('保存成功');
  636. setTimeout(() => {
  637. this.goBack();
  638. }, 1500)
  639. }).finally(res => {
  640. this.formLoading = false;
  641. })
  642. }
  643. })
  644. },
  645. submitStep5Form() {
  646. if (!this.qrcode1_url) {
  647. return this.$errorMsg('请上传小程序图片');
  648. }
  649. if (!this.qrcode2_url) {
  650. return this.$errorMsg('请上传公众号图片');
  651. }
  652. this.formLoading = true;
  653. let params = {
  654. adminUserId: this.id,
  655. qrcode1: this.qrcode1_url,
  656. qrcode2: this.qrcode2_url,
  657. companyWechatId: this.companyWechatId
  658. }
  659. editAccount(params).then(res => {
  660. this.$successMsg('保存成功');
  661. setTimeout(() => {
  662. this.goBack();
  663. }, 1500)
  664. }).finally(res => {
  665. this.formLoading = false;
  666. })
  667. },
  668. }
  669. }
  670. </script>
  671. <style lang="scss" scoped>
  672. .setting_title {
  673. padding-left: 0;
  674. }
  675. .tips {
  676. font-size: 14px;
  677. }
  678. .my-card {
  679. margin-top: 20px;
  680. .box {
  681. background: rgb(235, 240, 249);
  682. padding: 10px;
  683. font-size: 14px;
  684. margin: 20px 0;
  685. line-height: 18px;
  686. ::v-deep .el-link {
  687. vertical-align: unset;
  688. }
  689. }
  690. }
  691. .my-form {
  692. width: 450px;
  693. margin-top: 20px;
  694. }
  695. .show-pwd {
  696. position: absolute;
  697. right: 15px;
  698. top: 0;
  699. font-size: 16px;
  700. cursor: pointer;
  701. user-select: none;
  702. }
  703. .question {
  704. position: absolute;
  705. right: -30px;
  706. top: 0;
  707. font-size: 20px;
  708. cursor: pointer;
  709. user-select: none;
  710. }
  711. .reset {
  712. position: absolute;
  713. right: -110px;
  714. top: 0;
  715. }
  716. .my-form2 {
  717. ::v-deep input {
  718. width: 400px;
  719. }
  720. }
  721. .tips {
  722. margin-top: 10px;
  723. span {
  724. display: inline-block;
  725. width: 300px;
  726. text-align: center;
  727. line-height: 32px;
  728. background: #ffefef;
  729. font-size: 14px;
  730. color: #f66460;
  731. }
  732. }
  733. .images {
  734. display: flex;
  735. flex-wrap: wrap;
  736. .main-img {
  737. display: flex;
  738. flex-direction: column;
  739. justify-content: center;
  740. align-items: center;
  741. width: 120px;
  742. margin-right: 20px;
  743. .img {
  744. border: 1px dashed #eaeaea;
  745. border-radius: 5px;
  746. overflow: hidden;
  747. position: relative;
  748. .el-image {
  749. display: block;
  750. }
  751. .mask {
  752. position: absolute;
  753. left: 0;
  754. top: 0;
  755. width: 120px;
  756. height: 120px;
  757. background: rgba($color: #000000, $alpha: 0.3);
  758. display: flex;
  759. align-items: center;
  760. justify-content: center;
  761. i {
  762. font-size: 20px;
  763. color: #ffffff;
  764. cursor: pointer;
  765. margin: 0 8px;
  766. }
  767. }
  768. }
  769. .text {
  770. font-size: 14px;
  771. color: #666666;
  772. }
  773. }
  774. .add {
  775. width: 120px;
  776. height: 120px;
  777. border: 1px dashed #eaeaea;
  778. border-radius: 5px;
  779. cursor: pointer;
  780. display: flex;
  781. align-items: center;
  782. justify-content: center;
  783. i {
  784. font-size: 30px;
  785. color: #999;
  786. }
  787. }
  788. .tmp-img {
  789. position: relative;
  790. .tmp {
  791. position: absolute;
  792. left: 0;
  793. top: 0;
  794. line-height: 20px;
  795. padding: 0 8px;
  796. background: #f66460;
  797. border-radius: 0 0 10px 0;
  798. font-size: 12px;
  799. color: #ffffff;
  800. }
  801. }
  802. }
  803. </style>