brandMessage.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  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. uni.showToast({
  100. icon:'none',
  101. title:'成功'
  102. })
  103. uni.navigateBack({
  104. delta: 1 // 返回的页面数,默认为1
  105. })
  106. }
  107. else {
  108. uni.showToast({
  109. icon:'none',
  110. title:res.data.message
  111. })
  112. }
  113. })
  114. }
  115. else{
  116. this.$http.post('/merchant/localMerchantBrand/edit',{...data,id:this.form.logoId}).then(res => {
  117. if (res.data.success) {
  118. uni.showToast({
  119. icon:'none',
  120. title:res.data.result || '成功'
  121. })
  122. uni.navigateBack({
  123. delta: 1 // 返回的页面数,默认为1
  124. })
  125. }
  126. else {
  127. uni.showToast({
  128. icon:'none',
  129. title:res.data.message
  130. })
  131. }
  132. })
  133. }
  134. }
  135. }
  136. }
  137. </script>
  138. <style scoped lang="scss">
  139. page {
  140. background: #F8F8FA;
  141. }
  142. .tab-top {
  143. padding: 0 26upx;
  144. }
  145. .borderRadiu {
  146. background-color: #fff;
  147. .customize{
  148. padding: 0 18upx 18upx;
  149. }
  150. .title {
  151. font-size: 30upx;
  152. // padding: 10px;
  153. }
  154. .business-img {
  155. height: 210upx;
  156. width: 210upx;
  157. background-size: cover;
  158. image {
  159. width: 100%;
  160. height: 100%;
  161. }
  162. }
  163. .business-prompt{
  164. padding-top: 16upx;
  165. font-size: 20upx;
  166. color: #999999;
  167. }
  168. }
  169. .booder-top {
  170. border-bottom: 1px solid rgb(238, 238, 238);
  171. padding-bottom: 7px;
  172. }
  173. .sub-bottom {
  174. position: fixed;
  175. width: 100%;
  176. bottom: 0;
  177. background: #FFFFFF;
  178. border-top: 1px solid #EEEEEE;
  179. }
  180. </style>