index.vue 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980
  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="服务商商户号" prop="merchantId">
  185. <el-input v-model="step3Form.merchantId" autocomplete="off" placeholder="请输入服务商商户号"></el-input>
  186. </el-form-item>
  187. <el-form-item label="服务商商户密钥" prop="merchantKey">
  188. <el-input v-model="step3Form.merchantKey" autocomplete="off" placeholder="请输入服务商商户密钥"></el-input>
  189. </el-form-item>
  190. <el-form-item label="小程序appid" prop="appletAppid">
  191. <el-input v-model="step3Form.appletAppid" autocomplete="off" placeholder="请输入小程序appid"></el-input>
  192. </el-form-item>
  193. <el-form-item label="小程序密钥" prop="appletSecret">
  194. <el-input v-model="step3Form.appletSecret" 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-item label="收款二维码" prop="imgUrl">
  288. <div class="images">
  289. <div class="main-img">
  290. <div class="img" v-if="qrcode3_url" @mouseover="qrcode3_hover = true;" @mouseout="qrcode3_hover = false;">
  291. <el-image ref="qrcode3" :src="qrcode3_url" :preview-src-list="[qrcode3_url]"
  292. style="width: 120px; height: 120px" fit="contain"></el-image>
  293. <div class="mask" v-show="qrcode3_hover">
  294. <i class="el-icon-zoom-in" @click="previewImage('qrcode3')"></i>
  295. <i class="el-icon-upload2" @click="uploadImage('qrcode3')"></i>
  296. </div>
  297. </div>
  298. <div class="add" v-else @click="uploadImage('qrcode3')">
  299. <i class="el-icon-plus avatar-uploader-icon"></i>
  300. </div>
  301. </div>
  302. </div>
  303. <div class="tips">
  304. <span>建议尺寸:400*400</span>
  305. </div>
  306. </el-form-item>
  307. </el-form>
  308. </div>
  309. <div class="page-footer">
  310. <div class="footer" :class="classObj">
  311. <el-button type="primary" @click="submitStep1Form" :loading="formLoading" v-if="step == 'first'">{{ formLoading ?
  312. '保存中 ...' : '保 存' }}</el-button>
  313. <el-button type="primary" @click="submitStep2Form" :loading="formLoading" v-if="step == 'second'">{{ formLoading ?
  314. '保存中 ...' : '保 存' }}</el-button>
  315. <el-button type="primary" @click="submitStep3Form" :loading="formLoading" v-if="step == 'third'">{{ formLoading ?
  316. '保存中 ...' : '保 存' }}</el-button>
  317. <el-button type="primary" @click="submitStep4Form" :loading="formLoading" v-if="step == 'four'">{{ formLoading ?
  318. '保存中 ...' : '保 存' }}</el-button>
  319. <el-button type="primary" @click="submitStep5Form" :loading="formLoading" v-if="step == 'five'">{{ formLoading ?
  320. '保存中 ...' : '保 存' }}</el-button>
  321. <el-popconfirm title="确定关闭吗?" @confirm="goBack" style="margin-left: 10px;">
  322. <el-button slot="reference">关 闭</el-button>
  323. </el-popconfirm>
  324. </div>
  325. </div>
  326. <!-- 重置密码 -->
  327. <el-dialog title="重置密码" :visible.sync="resetFormVisible" :show-close="false" width="40%"
  328. :close-on-click-modal="false">
  329. <el-form ref="resetForm" :model="resetForm" :rules="resetFormRules" label-position="left" label-width="100px">
  330. <el-form-item label="输入新密码" prop="newPassword">
  331. <el-input v-model="resetForm.newPassword" ref="password1" autocomplete="off" placeholder="请输入新密码"
  332. :type="passwordType1"></el-input>
  333. <span class="show-pwd" @click="showPwd(1)">
  334. <svg-icon :icon-class="passwordType1 === 'password' ? 'eye' : 'eye-open'" />
  335. </span>
  336. </el-form-item>
  337. <el-form-item label="确认密码" prop="confirmPassword">
  338. <el-input v-model="resetForm.confirmPassword" ref="password2" autocomplete="off" placeholder="请再次输入新密码"
  339. :type="passwordType2"></el-input>
  340. <span class="show-pwd" @click="showPwd(2)">
  341. <svg-icon :icon-class="passwordType2 === 'password' ? 'eye' : 'eye-open'" />
  342. </span>
  343. </el-form-item>
  344. </el-form>
  345. <div slot="footer" class="dialog-footer">
  346. <el-button @click="cancelResetForm">取 消</el-button>
  347. <el-button type="primary" @click="submitResetForm">确 定</el-button>
  348. </div>
  349. </el-dialog>
  350. </div>
  351. </template>
  352. <script>
  353. import { getToken } from '@/utils/auth'
  354. import { getDetail, resetPassword, editAccount } from "@/api/merchant";
  355. import request from '@/utils/request'
  356. export default {
  357. data() {
  358. var validatePass = (rule, value, callback) => {
  359. if (value === '') {
  360. callback(new Error('请输入登录密码'));
  361. } else if (value.length < 12) {
  362. callback(new Error('密码长度至少12位'));
  363. } else if (/[A-Za-z].*[0-9]|[0-9].*[A-Za-z]/.test(value) == false) {
  364. callback(new Error('密码必须包含数字和字母'));
  365. } else {
  366. if (this.resetForm.confirmPassword !== '') {
  367. this.$refs.resetForm.validateField('confirmPassword');
  368. }
  369. callback();
  370. }
  371. };
  372. var validatePass2 = (rule, value, callback) => {
  373. if (value === '') {
  374. callback(new Error('请再次输入密码'));
  375. } else if (value !== this.resetForm.newPassword) {
  376. callback(new Error('两次输入密码不一致'));
  377. } else {
  378. callback();
  379. }
  380. };
  381. return {
  382. baseURL: process.env.VUE_APP_BASE_API,
  383. myHeaders: { 'x-token': getToken() },
  384. id: null,
  385. companyWechatId: null,
  386. step: 'first',
  387. step1Form: {
  388. account: '', // 账号
  389. nickName: '', // 用户名
  390. appName: '', // 小程序名称
  391. chargePerson: '', // 负责人
  392. phone: '', // 联系电话
  393. email: '', // 电子邮箱
  394. address: '', // 地址
  395. newPassword: '', // 新密码
  396. confirmPassword: '', // 确认密码
  397. companyExpireTime: '',
  398. moduleMaterialPart: '',
  399. moduleYb: '',
  400. moduleWb: '',
  401. },
  402. passwordType1: 'password',
  403. passwordType2: 'password',
  404. uploadImageType: null,
  405. img1_url: '',
  406. img1_hover: false,
  407. img2_url: '',
  408. img2_hover: false,
  409. img3_url: '',
  410. img3_hover: false,
  411. qrcode1_url: '',
  412. qrcode1_hover: false,
  413. qrcode2_url: '',
  414. qrcode2_hover: false,
  415. qrcode3_url: '',
  416. qrcode3_hover: false,
  417. resetFormVisible: false,
  418. resetForm: {
  419. newPassword: '', // 新密码
  420. confirmPassword: '', // 确认密码
  421. },
  422. resetFormRules: {
  423. newPassword: [
  424. { required: true, validator: validatePass, trigger: 'blur' }
  425. ],
  426. confirmPassword: [
  427. { required: true, validator: validatePass2, trigger: 'blur' }
  428. ],
  429. },
  430. step3Form: {
  431. enterpriseId: '',
  432. listSecret: '',
  433. listSyncSecret: '',
  434. appAgentId: '',
  435. appSecret: '',
  436. appId: '',
  437. merchantId: '',
  438. merchantKey: '',
  439. appletAppid: '',
  440. appletSecret: '',
  441. childMerchantId: '',
  442. templateId: '',
  443. pubAppId: '',
  444. pubAppSecret: '',
  445. pubTemplateId1:'',
  446. pubTemplateId2:'',
  447. pubTemplateId3:'',
  448. pubTemplateId4:'',
  449. pubTemplateId5:'',
  450. },
  451. step3FormRules: {
  452. enterpriseId: [
  453. // { required: true, message: '请输入企业ID', trigger: 'blur' }
  454. ],
  455. listSecret: [
  456. // { required: true, message: '请输入通讯录密钥(Secret)', trigger: 'blur' }
  457. ],
  458. listSyncSecret: [
  459. // { required: true, message: '请输入通讯录同步密钥(Secret)', trigger: 'blur' }
  460. ],
  461. appAgentId: [
  462. // { required: true, message: '请输入小程序(AgentiD)', trigger: 'blur' }
  463. ],
  464. appSecret: [
  465. // { required: true, message: '请输入小程序(Secret)', trigger: 'blur' }
  466. ],
  467. },
  468. step4Form: {
  469. dayNum: '',
  470. hourTime: ''
  471. },
  472. step4FormRules: {
  473. dayNum: [
  474. { required: true, message: '请输入天数', trigger: 'blur' }
  475. ],
  476. hourTime: [
  477. { required: true, message: '请选择执行时间', trigger: 'change' }
  478. ],
  479. },
  480. formLoading: false,
  481. }
  482. },
  483. computed: {
  484. sidebar() {
  485. return this.$store.state.app.sidebar
  486. },
  487. classObj() {
  488. return {
  489. hideSidebar: !this.sidebar.opened,
  490. openSidebar: this.sidebar.opened
  491. }
  492. },
  493. },
  494. created() {
  495. const { id, type } = this.$route.query;
  496. this.id = id;
  497. this.getDetail();
  498. if (type === 1) {
  499. this.step = 'first';
  500. } else if (type === 2) {
  501. this.step = 'second';
  502. } else if (type === 3) {
  503. this.step = 'third';
  504. }
  505. },
  506. methods: {
  507. goBack() {
  508. this.$router.go(-1);
  509. },
  510. // 获取详情
  511. getDetail() {
  512. getDetail({ adminUserId: this.id }).then(res => {
  513. this.step1Form.account = res.data.userName;
  514. this.step1Form.nickName = res.data.nickName;
  515. this.step1Form.appName = res.data.minAppName;
  516. this.step1Form.chargePerson = res.data.linkName;
  517. this.step1Form.phone = res.data.linkPhone;
  518. this.step1Form.email = res.data.email;
  519. this.step1Form.address = res.data.address;
  520. this.step1Form.password = '************';
  521. this.step1Form.companyExpireTime = res.data.companyExpireTime
  522. this.step1Form.moduleMaterialPart = res.data.moduleMaterialPart
  523. this.step1Form.moduleYb = res.data.moduleYb
  524. this.step1Form.moduleWb = res.data.moduleWb
  525. this.img1_url = res.data.minLogo1;
  526. this.img2_url = res.data.minLogo2;
  527. this.img3_url = res.data.minLogo3;
  528. this.qrcode1_url = res.data.qrcode1;
  529. this.qrcode2_url = res.data.qrcode2;
  530. this.qrcode3_url = res.data.payQrcode;
  531. this.step3Form.enterpriseId = res.data.corpId;
  532. this.step3Form.listSecret = res.data.secret2;
  533. this.step3Form.listSyncSecret = res.data.secret3;
  534. this.step3Form.appAgentId = res.data.agentId1;
  535. this.step3Form.appSecret = res.data.secret1;
  536. this.step3Form.appId = res.data.appId;
  537. this.step3Form.merchantId = res.data.mchId;
  538. this.step3Form.merchantKey = res.data.mchKey;
  539. this.step3Form.appletAppid = res.data.appletAppid;
  540. this.step3Form.appletSecret = res.data.appletSecret;
  541. this.step3Form.childMerchantId = res.data.subMchId;
  542. this.step3Form.templateId = res.data.template;
  543. this.step3Form.pubAppId = res.data.pubAppId;
  544. this.step3Form.pubAppSecret = res.data.pubAppSecret;
  545. this.step3Form.pubTemplateId1 = res.data.pubTemplateId1;
  546. this.step3Form.pubTemplateId2 = res.data.pubTemplateId2;
  547. this.step3Form.pubTemplateId3 = res.data.pubTemplateId3;
  548. this.step3Form.pubTemplateId4 = res.data.pubTemplateId4;
  549. this.step3Form.pubTemplateId5 = res.data.pubTemplateId5;
  550. this.companyWechatId = res.data.companyWechatId;
  551. this.step4Form.dayNum = res.data.dayNum
  552. this.step4Form.hourTime = res.data.hourTime
  553. })
  554. },
  555. // 重置密码
  556. handleReset(id) {
  557. this.resetId = id;
  558. this.resetFormVisible = true;
  559. },
  560. // 取消重置密码
  561. cancelResetForm() {
  562. this.resetFormVisible = false;
  563. this.passwordType1 = 'password';
  564. this.passwordType2 = 'password';
  565. this.$refs.resetForm.resetFields();
  566. },
  567. saveTime() {
  568. request({
  569. url: '/admin/user/user/updateCompanyWechat',
  570. method: 'post',
  571. data: {
  572. expireTime: this.step1Form.companyExpireTime,
  573. companyWechatId: this.companyWechatId
  574. }
  575. }).then(res => {
  576. if (res.code == 200) {
  577. this.$successMsg('保存成功');
  578. this.getDetail()
  579. }
  580. })
  581. },
  582. // 提交重置密码
  583. submitResetForm() {
  584. this.$refs.resetForm.validate((valid) => {
  585. if (valid) {
  586. let params = {
  587. password: this.resetForm.newPassword,
  588. adminUserId: this.id
  589. }
  590. resetPassword(params).then(res => {
  591. this.cancelResetForm();
  592. this.getDetail();
  593. this.$successMsg();
  594. })
  595. }
  596. })
  597. },
  598. // 显示隐藏密码
  599. showPwd(num) {
  600. if (num == 1) {
  601. if (this.passwordType1 === 'password') {
  602. this.passwordType1 = ''
  603. } else {
  604. this.passwordType1 = 'password'
  605. }
  606. this.$nextTick(() => {
  607. this.$refs.password1.focus()
  608. })
  609. }
  610. if (num == 2) {
  611. if (this.passwordType2 === 'password') {
  612. this.passwordType2 = ''
  613. } else {
  614. this.passwordType2 = 'password'
  615. }
  616. this.$nextTick(() => {
  617. this.$refs.password2.focus()
  618. })
  619. }
  620. },
  621. uploadImage(type) {
  622. this.uploadImageType = type;
  623. document.querySelector('.avatar-uploader input').click();
  624. },
  625. // 上传图片
  626. uploadSuccess(res, file) {
  627. this[this.uploadImageType + '_url'] = res.data.url;
  628. },
  629. beforeUpload(file) {
  630. const fileSuffix = file.name.substring(file.name.lastIndexOf(".") + 1);
  631. const whiteList = ['jpg', 'jpeg', 'png'];
  632. if (whiteList.indexOf(fileSuffix) === -1) {
  633. this.$errorMsg('只支持上传jpg/jpeg/png文件!');
  634. return false;
  635. }
  636. },
  637. // 预览图片
  638. previewImage(type) {
  639. this.$refs[type].showViewer = true;
  640. },
  641. submitStep1Form() {
  642. this.formLoading = true;
  643. let params = {
  644. // adminUserId: this.id,
  645. companyWechatId: this.companyWechatId,
  646. moduleMaterialPart: this.step1Form.moduleMaterialPart,
  647. moduleYb: this.step1Form.moduleYb,
  648. moduleWb: this.step1Form.moduleWb,
  649. }
  650. editAccount(params).then(res => {
  651. this.$successMsg('保存成功');
  652. setTimeout(() => {
  653. this.goBack();
  654. }, 1500)
  655. }).finally(res => {
  656. this.formLoading = false;
  657. })
  658. },
  659. submitStep2Form() {
  660. if (!this.img1_url) {
  661. return this.$errorMsg('请上传主logo');
  662. }
  663. if (!this.img2_url) {
  664. return this.$errorMsg('请上传通用logo');
  665. }
  666. if (!this.img3_url) {
  667. return this.$errorMsg('请上传头像logo');
  668. }
  669. this.formLoading = true;
  670. let params = {
  671. adminUserId: this.id,
  672. minLogo1: this.img1_url,
  673. minLogo2: this.img2_url,
  674. minLogo3: this.img3_url,
  675. companyWechatId: this.companyWechatId
  676. }
  677. editAccount(params).then(res => {
  678. this.$successMsg('保存成功');
  679. setTimeout(() => {
  680. this.goBack();
  681. }, 1500)
  682. }).finally(res => {
  683. this.formLoading = false;
  684. })
  685. },
  686. submitStep3Form() {
  687. this.$refs.step3Form.validate((valid) => {
  688. if (valid) {
  689. this.formLoading = true;
  690. let params = {
  691. adminUserId: this.id,
  692. corpId: this.step3Form.enterpriseId,
  693. secret2: this.step3Form.listSecret,
  694. secret3: this.step3Form.listSyncSecret,
  695. agentId1: this.step3Form.appAgentId,
  696. secret1: this.step3Form.appSecret,
  697. appId: this.step3Form.appId,
  698. mchId: this.step3Form.merchantId,
  699. mchKey: this.step3Form.merchantKey,
  700. appletAppid: this.step3Form.appletAppid,
  701. appletSecret: this.step3Form.appletSecret,
  702. subMchId: this.step3Form.childMerchantId,
  703. template: this.step3Form.templateId,
  704. pubAppId: this.step3Form.pubAppId,
  705. pubAppSecret: this.step3Form.pubAppSecret,
  706. pubTemplateId1: this.step3Form.pubTemplateId1,
  707. pubTemplateId2: this.step3Form.pubTemplateId2,
  708. pubTemplateId3: this.step3Form.pubTemplateId3,
  709. pubTemplateId4: this.step3Form.pubTemplateId4,
  710. pubTemplateId5: this.step3Form.pubTemplateId5,
  711. companyWechatId: this.companyWechatId
  712. }
  713. editAccount(params).then(res => {
  714. this.$successMsg('保存成功');
  715. setTimeout(() => {
  716. this.goBack();
  717. }, 1500)
  718. }).finally(res => {
  719. this.formLoading = false;
  720. })
  721. }
  722. })
  723. },
  724. submitStep4Form() {
  725. this.$refs.step4Form.validate((valid) => {
  726. if (valid) {
  727. this.formLoading = true;
  728. let params = {
  729. adminUserId: this.id,
  730. companyWechatId: this.companyWechatId,
  731. dayNum: this.step4Form.dayNum,
  732. hourTime: this.step4Form.hourTime,
  733. }
  734. editAccount(params).then(res => {
  735. this.$successMsg('保存成功');
  736. setTimeout(() => {
  737. this.goBack();
  738. }, 1500)
  739. }).finally(res => {
  740. this.formLoading = false;
  741. })
  742. }
  743. })
  744. },
  745. submitStep5Form() {
  746. // if (!this.qrcode1_url) {
  747. // return this.$errorMsg('请上传小程序图片');
  748. // }
  749. if (!this.qrcode2_url) {
  750. return this.$errorMsg('请上传公众号图片');
  751. }
  752. // if (!this.qrcode3_url) {
  753. // return this.$errorMsg('请上传收款二维码图片');
  754. // }
  755. this.formLoading = true;
  756. let params = {
  757. adminUserId: this.id,
  758. qrcode1: this.qrcode1_url,
  759. qrcode2: this.qrcode2_url,
  760. payQrcode: this.qrcode3_url,
  761. companyWechatId: this.companyWechatId
  762. }
  763. editAccount(params).then(res => {
  764. this.$successMsg('保存成功');
  765. setTimeout(() => {
  766. this.goBack();
  767. }, 1500)
  768. }).finally(res => {
  769. this.formLoading = false;
  770. })
  771. },
  772. }
  773. }
  774. </script>
  775. <style lang="scss" scoped>
  776. .setting_title {
  777. padding-left: 0;
  778. }
  779. .tips {
  780. font-size: 14px;
  781. }
  782. .my-card {
  783. margin-top: 20px;
  784. .box {
  785. background: rgb(235, 240, 249);
  786. padding: 10px;
  787. font-size: 14px;
  788. margin: 20px 0;
  789. line-height: 18px;
  790. ::v-deep .el-link {
  791. vertical-align: unset;
  792. }
  793. }
  794. }
  795. .my-form {
  796. width: 450px;
  797. margin-top: 20px;
  798. }
  799. .show-pwd {
  800. position: absolute;
  801. right: 15px;
  802. top: 0;
  803. font-size: 16px;
  804. cursor: pointer;
  805. user-select: none;
  806. }
  807. .question {
  808. position: absolute;
  809. right: -30px;
  810. top: 0;
  811. font-size: 20px;
  812. cursor: pointer;
  813. user-select: none;
  814. }
  815. .reset {
  816. position: absolute;
  817. right: -110px;
  818. top: 0;
  819. }
  820. .my-form2 {
  821. ::v-deep input {
  822. width: 400px;
  823. }
  824. }
  825. .tips {
  826. margin-top: 10px;
  827. span {
  828. display: inline-block;
  829. width: 300px;
  830. text-align: center;
  831. line-height: 32px;
  832. background: #ffefef;
  833. font-size: 14px;
  834. color: #f66460;
  835. }
  836. }
  837. .images {
  838. display: flex;
  839. flex-wrap: wrap;
  840. .main-img {
  841. display: flex;
  842. flex-direction: column;
  843. justify-content: center;
  844. align-items: center;
  845. width: 120px;
  846. margin-right: 20px;
  847. .img {
  848. border: 1px dashed #eaeaea;
  849. border-radius: 5px;
  850. overflow: hidden;
  851. position: relative;
  852. .el-image {
  853. display: block;
  854. }
  855. .mask {
  856. position: absolute;
  857. left: 0;
  858. top: 0;
  859. width: 120px;
  860. height: 120px;
  861. background: rgba($color: #000000, $alpha: 0.3);
  862. display: flex;
  863. align-items: center;
  864. justify-content: center;
  865. i {
  866. font-size: 20px;
  867. color: #ffffff;
  868. cursor: pointer;
  869. margin: 0 8px;
  870. }
  871. }
  872. }
  873. .text {
  874. font-size: 14px;
  875. color: #666666;
  876. }
  877. }
  878. .add {
  879. width: 120px;
  880. height: 120px;
  881. border: 1px dashed #eaeaea;
  882. border-radius: 5px;
  883. cursor: pointer;
  884. display: flex;
  885. align-items: center;
  886. justify-content: center;
  887. i {
  888. font-size: 30px;
  889. color: #999;
  890. }
  891. }
  892. .tmp-img {
  893. position: relative;
  894. .tmp {
  895. position: absolute;
  896. left: 0;
  897. top: 0;
  898. line-height: 20px;
  899. padding: 0 8px;
  900. background: #f66460;
  901. border-radius: 0 0 10px 0;
  902. font-size: 12px;
  903. color: #ffffff;
  904. }
  905. }
  906. }
  907. </style>