index.vue 36 KB

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