index.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402
  1. <template>
  2. <div>
  3. <div class="i-layout-page-header header-title">
  4. <span class="ivu-page-header-title" v-if="!isShowList">一号通账户<span
  5. class="title-tips">快速开通短信接口、物流接口、商品采集接口、电子面单接口等</span></span>
  6. <div v-if="isShowList" class="acea-row row-between-wrapper picTxt">
  7. <div slot="content">
  8. <Avatar class="dashboard-workplace-header-avatar" :src="imgUrl" />
  9. <div class="dashboard-workplace-header-tip">
  10. <p class="dashboard-workplace-header-tip-title">{{ smsAccount }},祝您每一天开心!</p>
  11. <p class="dashboard-workplace-header-tip-desc">
  12. <a href="#" @click="onChangePassswordIndex">修改密码</a>
  13. <Divider type="vertical" />
  14. <!-- <a href="#" @click="onChangePhone">修改手机号</a>
  15. <Divider type="vertical" /> -->
  16. <a href="#" @click="signOut">退出登录</a>
  17. </p>
  18. </div>
  19. </div>
  20. <div class="dashboard">
  21. <div class="dashboard-workplace-header-extra">
  22. <div class="acea-row">
  23. <div class="header-extra">
  24. <p class="mb5"><span>短信条数</span></p>
  25. <div v-if="sms.open === 0">
  26. <p>暂未开通</p>
  27. <Button size="small" type="primary" class="mt3 samll_font"
  28. @click="onOpen('sms')">开通服务</Button>
  29. </div>
  30. <div v-else>
  31. <p>{{ sms.num || 0 }}</p>
  32. <Button size="small" type="primary" class="mt3 samll_font" style="textalign: center"
  33. @click="mealPay('sms')">套餐购买</Button>
  34. </div>
  35. </div>
  36. <div class="header-extra">
  37. <p class="mb5"><span>采集次数</span></p>
  38. <div v-if="copy.open === 0">
  39. <p>暂未开通</p>
  40. <Button size="small" type="primary" class="mt3 samll_font"
  41. @click="onOpen('copy')">开通服务</Button>
  42. </div>
  43. <div v-else>
  44. <p>{{ copy.num || 0 }}</p>
  45. <Button size="small" type="primary" class="mt3 samll_font"
  46. @click="mealPay('copy')">套餐购买</Button>
  47. </div>
  48. </div>
  49. <div class="header-extra">
  50. <p class="mb5"><span>物流查询次数</span></p>
  51. <div v-if="query.open === 0">
  52. <p>暂未开通</p>
  53. <Button size="small" type="primary" class="mt3 samll_font"
  54. @click="onOpen('query')">开通服务</Button>
  55. </div>
  56. <div v-else>
  57. <p>{{ query.num || 0 }}</p>
  58. <Button size="small" type="primary" class="mt3 samll_font"
  59. @click="mealPay('expr_query')">套餐购买</Button>
  60. </div>
  61. </div>
  62. <div class="header-extra" style="border: none">
  63. <p class="mb5"><span>面单打印次数</span></p>
  64. <div v-if="dump.open === 0">
  65. <p>暂未开通</p>
  66. <Button size="small" type="primary" class="mt3 samll_font"
  67. @click="onOpen('dump')">开通服务</Button>
  68. </div>
  69. <div v-else>
  70. <p>{{ dump.num || 0 }}</p>
  71. <Button size="small" type="primary" class="mt3 samll_font"
  72. @click="mealPay('expr_dump')">套餐购买</Button>
  73. </div>
  74. </div>
  75. </div>
  76. </div>
  77. </div>
  78. </div>
  79. </div>
  80. <Card :bordered="false" dis-hover class="ivu-mt" style="min-height: 600px">
  81. <login-from @on-change="onChangePasssword" v-if="isShowLogn" @on-changes="onChangeReg"
  82. @on-Login="onLogin"></login-from>
  83. <forget-password v-if="isShow" @goback="goback" @on-Login="onLogin" :isIndex="isIndex"></forget-password>
  84. <register-from v-if="isShowReg" @on-change="logoup"></register-from>
  85. <table-list ref="tableLists" v-if="isShowList" :sms="sms" :copy="copy" :dump="dump" :query="query"
  86. :accountInfo="accountInfo" @openService="openService"></table-list>
  87. <forget-phone v-if="isForgetPhone" @gobackPhone="gobackPhone" @on-Login="onLogin"></forget-phone>
  88. <Spin size="large" fix v-if="spinShow"></Spin>
  89. </Card>
  90. </div>
  91. </template>
  92. <script>
  93. import loginFrom from './components/loginFrom';
  94. import forgetPassword from './components/forgetPassword';
  95. import registerFrom from './components/register';
  96. import tableList from './tableList';
  97. import forgetPhone from './components/forgetPhone';
  98. import {
  99. isLoginApi,
  100. logoutApi,
  101. smsNumberApi,
  102. serveInfoApi
  103. } from '@/api/setting';
  104. export default {
  105. name: 'smsConfig',
  106. components: {
  107. loginFrom,
  108. forgetPassword,
  109. registerFrom,
  110. tableList,
  111. forgetPhone
  112. },
  113. data() {
  114. return {
  115. imgUrl: require('@/assets/images/ren.png'),
  116. spinShow: false,
  117. isShowLogn: false, // 登录
  118. isShow: false, // 修改密码
  119. isShowReg: false, // 注册
  120. isShowList: false, // 登录之后列表
  121. smsAccount: '',
  122. accountInfo: {},
  123. isForgetPhone: false, // 修改手机号
  124. isIndex: false, // 判断忘记密码返回的路径
  125. sms: {
  126. open: 0
  127. }, // 短信信息
  128. query: {
  129. open: 0
  130. }, // 物流查询
  131. dump: {
  132. open: 0
  133. }, // 电子面单打印
  134. copy: {
  135. open: 0
  136. }, // 商品采集
  137. };
  138. },
  139. created() {
  140. this.onIsLogin();
  141. },
  142. methods: {
  143. onChangePhone() {
  144. this.isForgetPhone = true;
  145. this.isShowLogn = false;
  146. this.isShowList = false;
  147. },
  148. onOpen(val) {
  149. this.$refs.tableLists.onOpenIndex(val);
  150. },
  151. mealPay(val) {
  152. this.$router.push({
  153. path: this.$routeProStr + '/setting/sms/sms_pay/index',
  154. query: {
  155. type: val
  156. }
  157. });
  158. },
  159. // 开通服务
  160. openService(val) {
  161. switch (val) {
  162. case 'sms':
  163. this.sms.open = 1;
  164. break;
  165. case 'copy':
  166. this.copy.open = 1;
  167. break;
  168. case 'query':
  169. this.query.open = 1;
  170. break;
  171. default:
  172. this.dump.open = 1;
  173. break;
  174. }
  175. },
  176. // 平台用户信息
  177. getServeInfo() {
  178. this.spinShow = true;
  179. serveInfoApi()
  180. .then(async (res) => {
  181. let data = res.data;
  182. this.sms = {
  183. num: data.sms.num,
  184. open: data.sms.open,
  185. surp: data.sms.open,
  186. };
  187. this.query = {
  188. num: data.query.num,
  189. open: data.query.open,
  190. surp: data.query.open,
  191. };
  192. this.dump = {
  193. num: data.dump.num,
  194. open: data.dump.open,
  195. surp: data.dump.open,
  196. };
  197. this.copy = {
  198. num: data.copy.num,
  199. open: data.copy.open,
  200. surp: data.copy.open,
  201. };
  202. this.spinShow = false;
  203. this.smsAccount = data.account;
  204. this.accountInfo = data;
  205. })
  206. .catch((res) => {
  207. this.$Message.error(res.msg);
  208. this.isShowLogn = true;
  209. this.isShowList = false;
  210. this.spinShow = false;
  211. });
  212. },
  213. // 查看是否登录
  214. onIsLogin() {
  215. this.spinShow = true;
  216. isLoginApi()
  217. .then(async (res) => {
  218. let data = res.data;
  219. this.isShowLogn = !data.status;
  220. this.isShowList = data.status;
  221. this.spinShow = false;
  222. if (data.status) {
  223. this.getServeInfo();
  224. }
  225. })
  226. .catch((res) => {
  227. this.spinShow = false;
  228. this.$Message.error(res.msg);
  229. });
  230. },
  231. // 退出登录
  232. signOut() {
  233. logoutApi()
  234. .then(async (res) => {
  235. this.isShowLogn = true;
  236. this.isShowList = false;
  237. })
  238. .catch((res) => {
  239. this.$Message.error(res.msg);
  240. });
  241. },
  242. // 修改密码
  243. onChangePassswordIndex() {
  244. this.isIndex = true;
  245. this.passsword();
  246. },
  247. // 忘记密码
  248. onChangePasssword() {
  249. this.isIndex = false;
  250. this.passsword();
  251. // this.isShowLogn = false;
  252. // this.isShow = true;
  253. // this.isShowList = false;
  254. },
  255. passsword() {
  256. this.isShowLogn = false;
  257. this.isShow = true;
  258. this.isShowList = false;
  259. },
  260. // 立即注册
  261. onChangeReg() {
  262. this.isShowLogn = false;
  263. this.isShow = false;
  264. this.isShowReg = true;
  265. },
  266. // 立即登录
  267. logoup() {
  268. this.isShowLogn = true;
  269. this.isShow = false;
  270. this.isShowReg = false;
  271. },
  272. // 登录跳转
  273. onLogin() {
  274. let url = this.$route.query.url;
  275. if (url) {
  276. this.$router.replace(url + '?type=' + this.$route.query.type);
  277. } else {
  278. this.isShowLogn = false;
  279. this.isShow = false;
  280. this.isShowReg = false;
  281. this.isForgetPhone = false;
  282. this.isShowList = true;
  283. this.getServeInfo();
  284. }
  285. },
  286. // 密码返回
  287. goback() {
  288. if (this.isIndex) {
  289. this.isShowList = true;
  290. this.isShow = false;
  291. } else {
  292. this.isShowLogn = true;
  293. this.isShow = false;
  294. }
  295. },
  296. // 手机号返回
  297. gobackPhone() {
  298. this.isShowList = true;
  299. this.isForgetPhone = false;
  300. },
  301. },
  302. };
  303. </script>
  304. <style lang="less" scoped>
  305. .picTxt {
  306. padding: 8px 0 12px;
  307. }
  308. .dashboard {
  309. width: auto !important;
  310. min-width: 300px;
  311. }
  312. .header-extra {
  313. /*width: 25%;*/
  314. border-right: 1px solid #e9e9e9;
  315. text-align: center;
  316. padding: 0 18px;
  317. }
  318. .page-account-top-tit {
  319. font-size: 21px;
  320. color: #1890ff;
  321. }
  322. .dashboard-workplace {
  323. &-header {
  324. &-avatar {
  325. width: 64px;
  326. height: 64px;
  327. border-radius: 50%;
  328. margin-right: 16px;
  329. }
  330. &-tip {
  331. display: inline-block;
  332. vertical-align: middle;
  333. &-title {
  334. font-size: 20px;
  335. font-weight: bold;
  336. margin-bottom: 12px;
  337. }
  338. &-desc {
  339. color: #808695;
  340. }
  341. }
  342. &-extra {
  343. width: 100% !important;
  344. .ivu-col {
  345. p {
  346. text-align: right;
  347. }
  348. p:first-child {
  349. span:first-child {
  350. margin-right: 4px;
  351. }
  352. span:last-child {
  353. color: #808695;
  354. }
  355. }
  356. p:last-child {
  357. font-size: 22px;
  358. }
  359. }
  360. }
  361. }
  362. }
  363. @aaa: ~'>>>';
  364. .conBox {
  365. @{aaa} .ivu-page-header-extra {
  366. width: auto !important;
  367. min-width: 457px;
  368. }
  369. @{aaa} .ivu-page-header {
  370. padding: 16px 0px 0 32px !important;
  371. }
  372. }
  373. .samll_font {
  374. text-align: center;
  375. padding: 0px 10px;
  376. }
  377. .title-tips {
  378. font-size: 14px;
  379. color: #999;
  380. margin-left: 10px;
  381. }
  382. </style>