brandMessage.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  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="$Router.push({ name: 'settings' })">取消</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. async businessChange() {
  60. let [chooseImageErr, chooseImageRes] = await uni.chooseImage({
  61. count: 1,
  62. sizeType: ['compressed']
  63. });
  64. let size = chooseImageRes.tempFiles[0].size / 1024 / 1024 < 5;
  65. if (!size) {
  66. this.$refs.uToast.show({
  67. title: '上传图片大小不能超过 5MB!',
  68. type: 'error',
  69. })
  70. return false
  71. }
  72. if (chooseImageRes) {
  73. // this.logoImg = chooseImageRes.tempFilePaths[0];
  74. uni.uploadFile({
  75. url: configService.apiUrl + '/sys/common/upload',
  76. filePath: chooseImageRes.tempFilePaths[0],
  77. name: "file",
  78. formData: {
  79. 'biz': 'temp',
  80. },
  81. success: (files) => {
  82. let data = JSON.parse(files.data);
  83. if (data.success) {
  84. this.logoImg =configService.apiUrl + '/' + data.message
  85. }
  86. }
  87. });
  88. }
  89. },
  90. sumbit(){
  91. let data={
  92. merchantId:uni.getStorageSync(USER_INFO).merchantId,
  93. logo:this.logoImg,
  94. }
  95. if(this.form.logoStatus==null){
  96. // this.$http.post('/merchant/localMerchantBrand/add',data).then(res => {
  97. this.$http.post('/merchant/localMerchantBrand/addNew',data).then(res => {
  98. if (res.data.success) {
  99. this.$tip.success(res.data.result || '成功')
  100. uni.navigateBack({
  101. delta: 1 // 返回的页面数,默认为1
  102. })
  103. }
  104. else {
  105. this.$tip.error(res.data.message);
  106. }
  107. })
  108. }
  109. else{
  110. this.$http.post('/merchant/localMerchantBrand/edit',{...data,id:this.form.logoId}).then(res => {
  111. if (res.data.success) {
  112. this.$tip.success(res.data.result || '成功')
  113. uni.navigateBack({
  114. delta: 1 // 返回的页面数,默认为1
  115. })
  116. }
  117. else {
  118. this.$tip.error(res.data.message);
  119. }
  120. })
  121. }
  122. }
  123. }
  124. }
  125. </script>
  126. <style scoped lang="scss">
  127. page {
  128. background: #F8F8FA;
  129. }
  130. .tab-top {
  131. padding: 0 26upx;
  132. }
  133. .borderRadiu {
  134. background-color: #fff;
  135. .customize{
  136. padding: 0 18upx 18upx;
  137. }
  138. .title {
  139. font-size: 30upx;
  140. // padding: 10px;
  141. }
  142. .business-img {
  143. height: 210upx;
  144. width: 210upx;
  145. background-size: cover;
  146. image {
  147. width: 100%;
  148. height: 100%;
  149. }
  150. }
  151. .business-prompt{
  152. padding-top: 16upx;
  153. font-size: 20upx;
  154. color: #999999;
  155. }
  156. }
  157. .booder-top {
  158. border-bottom: 1px solid rgb(238, 238, 238);
  159. padding-bottom: 7px;
  160. }
  161. .sub-bottom {
  162. position: fixed;
  163. width: 100%;
  164. bottom: 0;
  165. background: #FFFFFF;
  166. border-top: 1px solid #EEEEEE;
  167. }
  168. </style>