兼兼街公众号代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

156 lines
3.0 KiB

  1. <template>
  2. <view>
  3. <view class="from">
  4. <view class="from-line">
  5. <span class="label-class">姓名:</span>
  6. <view><input v-model="release.name" placeholder="请输入姓名"/></view>
  7. </view>
  8. <view class="from-line">
  9. <span class="label-class">电话:</span>
  10. <view><input v-model="release.phone" placeholder="请输入电话"/></view>
  11. </view>
  12. <view class="from-line">
  13. <span class="label-class">地址:</span>
  14. <view><input v-model="release.region" placeholder="请输入地址信息"/></view>
  15. </view>
  16. <view class="from-line">
  17. <span class="label-class">详细地址:</span>
  18. <view><input v-model="release.detailAddress" placeholder="请输入地址详情"/></view>
  19. </view>
  20. </view>
  21. <view class="pay-btn" @click="fabujianzhi()">
  22. 提交地址信息
  23. </view>
  24. </view>
  25. </template>
  26. <script>
  27. import userCard from '@/components/user-card/index.vue'
  28. export default{
  29. components:{
  30. userCard
  31. },
  32. data(){
  33. return{
  34. release:{
  35. name:"",
  36. phone:"",
  37. region:"",
  38. detailAddress:"",
  39. }
  40. }
  41. },
  42. onShow() {
  43. this.getmyInfo()
  44. },
  45. onLoad() {
  46. },
  47. onReady() {
  48. this.$com.displayNav()
  49. },
  50. methods:{
  51. getmyInfo(){
  52. this.$api('myInfo')
  53. .then(res=>{
  54. if(res.code == 200){
  55. this.role = res.result.role;
  56. this.userInfo = res.result;
  57. this.$store.commit('set_userInfo',res.result)
  58. }else{
  59. this.userInfo = null
  60. }
  61. })
  62. },
  63. fabujianzhi(){
  64. let that = this;
  65. if(that.release.name == ''){
  66. this.$Toast("姓名不能为空");
  67. return
  68. }
  69. if(that.release.phone == null){
  70. this.$Toast("电话不能为空")
  71. return
  72. }
  73. if(that.release.region == ''){
  74. this.$Toast("地址不能为空")
  75. return
  76. }
  77. if(that.release.detailAddress == null){
  78. this.$Toast("地址详情不能为空")
  79. return
  80. }
  81. let params = {
  82. name:that.release.name,
  83. phone:that.release.phone,
  84. region:that.release.region,
  85. detailAddress:that.release.detailAddress,
  86. }
  87. that.$api('saveOrUpdateAddress',params).then(res=>{
  88. this.$Toast(res.message);
  89. setTimeout(()=>{
  90. uni.navigateTo({
  91. url:'/pages/my/my-address-list'
  92. })
  93. },1500)
  94. });
  95. },
  96. }
  97. }
  98. </script>
  99. <style lang="scss" scoped>
  100. .from {
  101. margin-top: 20rpx;
  102. }
  103. .from-line {
  104. height: 138rpx;
  105. display: flex;
  106. .label-class{
  107. text-align: justify;
  108. text-align-last: justify;
  109. line-height: 128rpx;
  110. width: 128rpx;
  111. padding: 0 24rpx;
  112. }
  113. input{
  114. padding-left: 10rpx;
  115. height: 128rpx;
  116. line-height: 128rpx;
  117. }
  118. }
  119. .from-line-box {
  120. height: 328rpx;
  121. margin-right: 50rpx;
  122. display: flex;
  123. .label-class{
  124. text-align: justify;
  125. text-align-last: justify;
  126. line-height: 128rpx;
  127. width: 128rpx;
  128. padding: 0 24rpx;
  129. }
  130. input{
  131. padding-left: 20rpx;
  132. height: 228rpx;
  133. line-height: 128rpx;
  134. }
  135. }
  136. .pay-btn{
  137. margin:190rpx auto;
  138. width: 387rpx;
  139. text-align: center;
  140. border-radius: 12rpx;
  141. height: 78rpx;
  142. line-height: 78rpx;
  143. background-color: #00CCCC;
  144. color: #FFFFFF;
  145. }
  146. </style>