index.vue 35 KB

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