storeMessage.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. <template>
  2. <view class="content">
  3. <view class="item">
  4. <view class="item-tit">
  5. 店铺名称
  6. </view>
  7. <input type="text" v-model="store.name"/>
  8. </view>
  9. <view class="item">
  10. <view class="item-tit">
  11. 商家电话
  12. </view>
  13. <input type="number" v-model="store.phone"/>
  14. </view>
  15. <view class="item">
  16. <view class="item-tit">
  17. 商家地址
  18. </view>
  19. <input type="text" v-model="store.detailed_address"/>
  20. </view>
  21. <view class="item">
  22. <view class="item-tit">
  23. 营业时间
  24. </view>
  25. <input type="text" v-model="store.day_time"/>
  26. </view>
  27. <view class="item">
  28. <view class="item-tit">
  29. 商户简介
  30. </view>
  31. <textarea v-model="store.introduction" placeholder="" />
  32. </view>
  33. <view class="item">
  34. <view class="item-tit">
  35. 门户头像
  36. </view>
  37. <view class="up-wrapper">
  38. <image :src="store.image" mode="" v-if="store.image" @click.stop="upImg"></image>
  39. <image src="../../static/img/add.png" mode="" v-else @click.stop="upImg"></image>
  40. </view>
  41. </view>
  42. <view class="sub" @click="sub">
  43. 确认修改
  44. </view>
  45. </view>
  46. </template>
  47. <script>
  48. import {
  49. upload,editStore
  50. } from '@/api/user.js';
  51. export default {
  52. data() {
  53. return {
  54. store: {},
  55. // name: '鑫旺零售台州店',
  56. // phone: '12345678911',
  57. // address: '台州市市府大道110号',
  58. // info: '店铺简介店铺简介店铺简介店铺简介店铺简介店铺简介铺简介店铺简介店铺简介店铺简介店铺简介店铺简介店铺简介',
  59. // workTime: '8:30-12:00,13:30-17:00',
  60. // logo: ''
  61. }
  62. },
  63. onLoad(opt) {
  64. this.store = JSON.parse(opt.item)
  65. console.log(this.store,'this.store++++++++++++')
  66. },
  67. methods:{
  68. // 修改logo
  69. upImg() {
  70. let obj = this
  71. upload({
  72. filename: ''
  73. }).then(res => {
  74. console.log(res[0].url)
  75. obj.store.image= res[0].url
  76. });
  77. },
  78. //提交
  79. sub() {
  80. let obj = this
  81. let store = obj.store
  82. if(store.name == '') {
  83. obj.$api.msg('请输入店铺名称')
  84. return
  85. }
  86. if(store.phone == '') {
  87. obj.$api.msg('请输入店铺电话')
  88. return
  89. }
  90. if(store.image == '') {
  91. obj.$api.msg('请选择店铺头像')
  92. return
  93. }
  94. if(store.day_time == '') {
  95. obj.$api.msg('请输入营业时间')
  96. return
  97. }
  98. if(store.introduction == '') {
  99. obj.$api.msg('请输入店铺简介')
  100. return
  101. }
  102. if(store.detailed_address == '') {
  103. obj.$api.msg('请输入店铺地址')
  104. return
  105. }
  106. uni.showLoading({
  107. title: '提交中...',
  108. mask: true
  109. })
  110. editStore({
  111. name: store.name,
  112. introduction: store.introduction,
  113. image: store.image,
  114. phone: store.phone,
  115. day_time: store.day_time
  116. }).then( res => {
  117. uni.hideLoading()
  118. uni.showToast({
  119. title: '提交成功',
  120. duration: 2000
  121. });
  122. setTimeout(()=> {
  123. uni.navigateBack({})
  124. },2000)
  125. }).catch( err => {
  126. uni.hideLoading()
  127. console.log(err)
  128. })
  129. }
  130. }
  131. }
  132. </script>
  133. <style lang="scss" scoped>
  134. page {
  135. height: 100%;
  136. background-color: #f8f6f6;
  137. }
  138. .item {
  139. background-color: #fff !important;
  140. min-height: 100rpx;
  141. display: flex;
  142. width: 750px;
  143. border: 1px #F4F4F4 solid;
  144. .item-tit {
  145. height: 100rpx;
  146. line-height: 100rpx;
  147. padding-left: 30rpx;
  148. width: 200rpx;
  149. font-size: 30rpx;
  150. font-family: PingFang SC;
  151. font-weight: 500;
  152. color: #666666;
  153. flex-shrink: 0;
  154. }
  155. input {
  156. width: 550rpx;
  157. height: 100rpx;
  158. line-height: 100rpx;
  159. font-size: 30rpx;
  160. font-family: PingFang SC;
  161. font-weight: 500;
  162. color: #333333;
  163. }
  164. textarea {
  165. width: 550rpx;
  166. height: 257rpx;
  167. padding-top: 45rpx;
  168. padding-right: 30rpx;
  169. line-height: 50rpx;
  170. font-size: 30rpx;
  171. font-family: PingFang SC;
  172. font-weight: 500;
  173. color: #333333;
  174. }
  175. .up-wrapper {
  176. height: 352rpx;
  177. width: 550rpx;
  178. position: relative;
  179. image {
  180. position: absolute;
  181. height: 160rpx;
  182. width: 160rpx;
  183. top: 0;
  184. bottom: 0;
  185. left: 94rpx;
  186. margin: auto;
  187. }
  188. }
  189. }
  190. .sub {
  191. width: 674rpx;
  192. height: 88rpx;
  193. background: #FF4C4C;
  194. border-radius: 44rpx;
  195. line-height: 88rpx;
  196. text-align: center;
  197. font-size: 36rpx;
  198. font-family: PingFang SC;
  199. font-weight: 500;
  200. color: #FFFFFF;
  201. position: absolute;
  202. bottom: 35rpx;
  203. left: 0;
  204. right: 0;
  205. margin: auto;
  206. }
  207. </style>