brandMessage.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. <template>
  2. <view>
  3. <cu-custom bgColor="bg-fff" :isBack="true">
  4. <block slot="content"> 品牌信息</block>
  5. </cu-custom>
  6. <status v-if="form && form.logoStatus !== null" :status="form.logoStatus" :updateTime="form.logoUpdateTime" :remark="form.logoRemark"></status>
  7. <view class="tab-top" :style="form && form.logoStatus == null ? 'margin-top: 14upx' : 'margin-top: 144upx;'">
  8. <form>
  9. <view class="borderRadiu">
  10. <view class=" cu-form-group margin-top1 justify-between">
  11. <view class="content ">
  12. <text class="text-bold">品牌/logo</text>
  13. <i class="text-bg "></i>
  14. </view>
  15. <!-- <view class="title" style="color: #449AFF;font-size: 26upx;">查看示例</view> -->
  16. </view>
  17. <view class="customize">
  18. <view class="booder-top">
  19. <view class="business-img ">
  20. <image :src="logoImg ? logoImg : '/static/store/upload1.png'" mode=""
  21. @click="businessChange()"></image>
  22. </view>
  23. </view>
  24. <view class="business-prompt">
  25. 该图片会在门店列表作为门店头像展示,建议上传能代表门店的照片,如品牌Logo,招牌,门牌等;
  26. <br>图片比例1:1,支持png,jpg,jpeg格式,大小不超过5M
  27. </view>
  28. </view>
  29. </view>
  30. </form>
  31. </view>
  32. <view class="padding flex sub-bottom">
  33. <button class="cu-btn round line-gray shadow" @click="back()">取消</button>
  34. <button style="margin-left: 12upx;width:77%" class="cu-btn bg-blue round " @click="sumbit">提交审核</button>
  35. </view>
  36. </view>
  37. </template>
  38. <script>
  39. import configService from '../../common/service/config.service'
  40. import { USER_INFO } from "@/common/util/constants"
  41. import status from "./components/status.vue"
  42. export default {
  43. data(){
  44. return{
  45. logoImg: '',
  46. form:{}
  47. }
  48. },
  49. components:{status},
  50. async onLoad(data) {
  51. if (data.params) {
  52. let obj = JSON.parse(decodeURIComponent(data.params));
  53. this.form = obj
  54. this.logoImg=obj.logo
  55. console.log(obj,this.logoImg)
  56. }
  57. },
  58. methods: {
  59. back() {
  60. uni.navigateBack()
  61. },
  62. async businessChange() {
  63. let [chooseImageErr, chooseImageRes] = await uni.chooseImage({
  64. count: 1,
  65. sizeType: ['compressed']
  66. });
  67. let size = chooseImageRes.tempFiles[0].size / 1024 / 1024 < 5;
  68. if (!size) {
  69. this.$refs.uToast.show({
  70. title: '上传图片大小不能超过 5MB!',
  71. type: 'error',
  72. })
  73. return false
  74. }
  75. if (chooseImageRes) {
  76. // this.logoImg = chooseImageRes.tempFilePaths[0];
  77. uni.uploadFile({
  78. url: configService.apiUrl + '/sys/common/upload',
  79. filePath: chooseImageRes.tempFilePaths[0],
  80. name: "file",
  81. formData: {
  82. 'biz': 'temp',
  83. },
  84. success: (files) => {
  85. let data = JSON.parse(files.data);
  86. if (data.success) {
  87. this.logoImg =configService.apiUrl + '/' + data.message
  88. }
  89. }
  90. });
  91. }
  92. },
  93. sumbit(){
  94. let data={
  95. merchantId:uni.getStorageSync(USER_INFO).merchantId,
  96. logo:this.logoImg,
  97. }
  98. if(this.form.logoStatus==null){
  99. // this.$http.post('/merchant/localMerchantBrand/add',data).then(res => {
  100. this.$http.post('/merchant/localMerchantBrand/addNew',data).then(res => {
  101. if (res.data.code == 200) {
  102. uni.showToast({
  103. icon:'none',
  104. title:res.data.message || '成功'
  105. })
  106. setTimeout(()=>{
  107. uni.navigateBack({
  108. delta: 1 // 返回的页面数,默认为1
  109. })
  110. },1000)
  111. } else {
  112. uni.showToast({
  113. icon:'none',
  114. title:res.data.message
  115. })
  116. }
  117. })
  118. }
  119. else{
  120. this.$http.post('/merchant/localMerchantBrand/edit',{...data,id:this.form.logoId}).then(res => {
  121. if (res.data.code == 200) {
  122. uni.showToast({
  123. icon:'none',
  124. title:res.data.message || '成功'
  125. })
  126. setTimeout(()=>{
  127. uni.navigateBack({
  128. delta: 1 // 返回的页面数,默认为1
  129. })
  130. },1000)
  131. } else {
  132. uni.showToast({
  133. icon:'none',
  134. title:res.data.message
  135. })
  136. }
  137. })
  138. }
  139. }
  140. }
  141. }
  142. </script>
  143. <style scoped lang="scss">
  144. page {
  145. background: #F8F8FA;
  146. }
  147. .tab-top {
  148. padding: 0 26upx;
  149. }
  150. .borderRadiu {
  151. background-color: #fff;
  152. .customize{
  153. padding: 0 18upx 18upx;
  154. }
  155. .title {
  156. font-size: 30upx;
  157. // padding: 10px;
  158. }
  159. .business-img {
  160. height: 210upx;
  161. width: 210upx;
  162. background-size: cover;
  163. image {
  164. width: 100%;
  165. height: 100%;
  166. }
  167. }
  168. .business-prompt{
  169. padding-top: 16upx;
  170. font-size: 20upx;
  171. color: #999999;
  172. }
  173. }
  174. .booder-top {
  175. border-bottom: 1px solid rgb(238, 238, 238);
  176. padding-bottom: 7px;
  177. }
  178. .sub-bottom {
  179. position: fixed;
  180. width: 100%;
  181. bottom: 0;
  182. background: #FFFFFF;
  183. border-top: 1px solid #EEEEEE;
  184. }
  185. </style>