Index.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <template>
  2. <div class="shopIndex-wrap">
  3. <div class="mess-wrap">
  4. <div class="mess-title">
  5. <h5>您好!{{$store.state.userMess.userName}}用户</h5>
  6. <el-button @click="toShowEditShop">修改用户信息</el-button>
  7. </div>
  8. <div>
  9. <img src="../../assets/images/admin/userImg.png" />
  10. <div class="mess-content">
  11. <p>用户昵称:{{$store.state.userMess.userName}}</p>
  12. <p>登陆账号:{{$store.state.userMess.loginId}}</p>
  13. <p>登陆密码:{{$store.state.userMess.password}}</p>
  14. <p>邮寄地址:{{$store.state.userMess.address}}</p>
  15. </div>
  16. </div>
  17. </div>
  18. <el-dialog :title="dialogTitle" :visible.sync="dialogTableVisible" :show-close="false">
  19. <div class="dialogheader">
  20. <el-form label-position="right" label-width="80px">
  21. <el-form-item label="用户昵称">
  22. <el-input v-model="showItem.userName"></el-input>
  23. </el-form-item>
  24. <el-form-item label="登陆账号">
  25. <el-input v-model="showItem.name"></el-input>
  26. </el-form-item>
  27. <el-form-item label="登陆密码">
  28. <el-input v-model="showItem.password"></el-input>
  29. </el-form-item>
  30. <el-form-item label="邮寄地址">
  31. <el-input v-model="showItem.address"></el-input>
  32. </el-form-item>
  33. <el-form-item>
  34. <el-button type="primary" @click="toEditShop">确认修改</el-button>
  35. <el-button @click="toCancel">取消</el-button>
  36. </el-form-item>
  37. </el-form>
  38. </div>
  39. </el-dialog>
  40. </div>
  41. </template>
  42. <script>
  43. export default{
  44. data(){
  45. return{
  46. dialogTableVisible:false,
  47. dialogTitle:"",
  48. showItem:{
  49. id:"",
  50. userName:"",
  51. name:"",
  52. password:"",
  53. label:"",
  54. address:"",
  55. }
  56. }
  57. },
  58. mounted(){
  59. },
  60. methods:{
  61. toCancel(){
  62. this.dialogTableVisible=false;
  63. this.dialogTitle="";
  64. this.showItem={
  65. id:"",
  66. userName:"",
  67. name:"",
  68. password:"",
  69. label:""
  70. }
  71. },
  72. toShowEditShop(){
  73. this.dialogTableVisible=true;
  74. this.dialogTitle="修改信息";
  75. this.showItem.id=this.$store.state.userMess.id;
  76. this.showItem.userName=this.$store.state.userMess.userName;
  77. this.showItem.name=this.$store.state.userMess.loginId;
  78. this.showItem.password=this.$store.state.userMess.password;
  79. this.showItem.address=this.$store.state.userMess.address;
  80. },
  81. toEditShop(){
  82. if(this.showItem.name==""||this.showItem.password==""||this.showItem.userName==""||this.showItem.address==""){
  83. this.$message.error('请填写完整信息');
  84. console.log(this.showItem)
  85. return;
  86. }
  87. let param={
  88. type:2,
  89. handle:"2",
  90. mess:this.showItem
  91. }
  92. this.axios.post(this.Api.adminHandle,param).then((res)=>{
  93. console.log(res);
  94. if(res.data.code==200){
  95. this.$message({
  96. message: '编辑成功',
  97. type: 'success'
  98. });
  99. this.toCancel();
  100. this.$store.commit('login',{userMess:res.data.afterEdit.mess});
  101. }
  102. }).catch((err)=>{
  103. console.log("toEditShop:"+err);
  104. });
  105. }
  106. }
  107. }
  108. </script>
  109. <style scoped>
  110. .shopIndex-wrap{
  111. width: 100%;
  112. padding: 0 20px;
  113. }
  114. .mess-title{
  115. width: 100%;
  116. padding: 0 20px;
  117. text-align: left;
  118. }
  119. .mess-title h5{
  120. font-size: 18px;
  121. line-height: 35px;
  122. display: inline-block;
  123. }
  124. .mess-title button{
  125. float: right;
  126. }
  127. .mess-title .el-button{
  128. padding: 8px 16px;
  129. margin-top: 5px;
  130. }
  131. .shopIndex-wrap .mess-wrap{
  132. width: 100%;
  133. height: 185px;
  134. margin-top: 20px;
  135. background-color: #fff;
  136. border-left: 6px solid #3eb983;
  137. }
  138. .shopIndex-wrap .mess-wrap img{
  139. width: 110px;
  140. height: 110px;
  141. display: block;
  142. float: left;
  143. margin: 15px 20px 15px;
  144. }
  145. .shopIndex-wrap .mess-content{
  146. width: calc(100% - 150px);
  147. height: 100%;
  148. float: left;
  149. margin-top: 5px;
  150. }
  151. .shopIndex-wrap .mess-content p{
  152. text-align: left;
  153. font-size: 16px;
  154. line-height: 35px;
  155. }
  156. </style>
  157. <style>
  158. .shopIndex-wrap .el-dialog{
  159. width: 500px;
  160. /*height: 280px;*/
  161. border-radius: 6px;
  162. text-align: left;
  163. }
  164. .shopIndex-wrap .el-dialog__header{
  165. padding: 20px 30px 0 40px;
  166. }
  167. .shopIndex-wrap .el-dialog__body{
  168. padding: 20px 30px;
  169. }
  170. .shopIndex-wrap .dialogheader{
  171. width: 100%;
  172. /*height: 60px;*/
  173. }
  174. .shopIndex-wrap .dialogheader p{
  175. width: 360px;
  176. height: 30px;
  177. line-height: 30px;
  178. margin-top: 10px;
  179. border:1px solid #3eb983;
  180. border-radius: 6px;
  181. text-align: left;
  182. padding-left: 10px;
  183. margin-left: 60px;
  184. }
  185. .shopIndex-wrap .dialogheader p input{
  186. height: 24px;
  187. line-height: 24px;
  188. border:0;
  189. margin-left: 20px;
  190. }
  191. .shopIndex-wrap .dialogheader .button{
  192. background: #3eb983;
  193. color: #fff;
  194. text-align: center;
  195. margin-top: 40px;
  196. cursor: pointer;
  197. }
  198. .shopIndex-wrap .dialogheader .el-button{
  199. width: 173px;
  200. padding: 10px 0;
  201. }
  202. .shopIndex-wrap .dialogheader .el-form-item{
  203. margin-bottom: 15px;
  204. }
  205. .shopIndex-wrap .dialogheader .el-button+.el-button{
  206. margin-left: 0;
  207. }
  208. .shopIndex-wrap .dialogheader .el-button--primary{
  209. background-color: #3eb983;
  210. border-color: #3eb983;
  211. }
  212. .shopIndex-wrap .dialogheader .el-button--primary:hover{
  213. background-color: #3eb983;
  214. border-color: #3eb983;
  215. }
  216. .shopIndex-wrap .dialogheader .el-button--default{
  217. background-color: #bfcbd9;
  218. color: #fff;
  219. }
  220. .shopIndex-wrap .dialogheader .el-button--default:hover{
  221. background-color: #bfcbd9;
  222. border-color: #bfcbd9;
  223. color: #fff;
  224. }
  225. </style>