apply.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. <template>
  2. <view>
  3. <view class="cn">
  4. <u-steps :list="numList" mode="number" :current="item.auditFlag + 1" active-color="#c74547"></u-steps>
  5. <view class="info">
  6. <view class="form_group hr">
  7. <view class="lable">商铺类型</view>
  8. <u-radio-group v-model="item.shopType" active-color="#c74547">
  9. <u-radio :name="1">商铺</u-radio>
  10. <u-radio :name="2">酒店</u-radio>
  11. </u-radio-group>
  12. </view>
  13. <view class="form_group hr">
  14. <view class="lable">商铺名称</view>
  15. <input type="text" placeholder="请输入商铺名称" v-model="item.name" />
  16. </view>
  17. <view class="form_group hr">
  18. <view class="lable">商铺地址</view>
  19. <input type="text" placeholder="请输入商铺地址" v-model="item.addres" />
  20. <view class="dw icon" @click="wz(1)">&#xe64a;</view>
  21. </view>
  22. <view class="form_group hr">
  23. <view class="lable">负责人</view>
  24. <input type="text" placeholder="请输入负责人" v-model="item.bossName" />
  25. </view>
  26. <view class="form_group hr">
  27. <view class="lable">联系电话</view>
  28. <input type="number" placeholder="请输入联系电话" v-model="item.bossPhone" />
  29. </view>
  30. <view class="form_group">
  31. <view class="lable">营业执照</view>
  32. <view class="text">请上传1张营业执照</view>
  33. </view>
  34. <view class="pl5">
  35. <u-upload
  36. :ip="ip"
  37. :action="upload.action"
  38. :header="upload.header"
  39. :size-type="upload.size"
  40. :max-count="1"
  41. :name="upload.name"
  42. :file-list="item.pic"
  43. :deletable="item.auditFlag != 1"
  44. :show-progress="item.auditFlag != 1"
  45. :custom-btn="item.auditFlag == 1"
  46. ref="pic"
  47. width="140"
  48. height="140"
  49. ></u-upload>
  50. </view>
  51. <view class="form_group">
  52. <view class="lable">图片展示</view>
  53. <view class="text">最多上传5张展示图片</view>
  54. </view>
  55. <view class="pl5">
  56. <u-upload
  57. :ip="ip"
  58. :action="upload.action"
  59. :header="upload.header"
  60. :size-type="upload.size"
  61. :max-count="upload.count"
  62. :name="upload.name"
  63. :file-list="item.showPictures"
  64. :deletable="item.auditFlag != 1"
  65. :show-progress="item.auditFlag != 1"
  66. :custom-btn="item.auditFlag == 1"
  67. ref="uUpload"
  68. width="140"
  69. height="140"
  70. ></u-upload>
  71. </view>
  72. <view class="form_group"><view class="lable">商铺简介</view></view>
  73. <textarea placeholder="请输入商铺简介(200字以内)" v-model="item.briefContent" maxlength="200" />
  74. </view>
  75. <button class="btn" @click="up()" v-if="item.auditFlag == -1">申请开通</button>
  76. <button class="btn" @click="up()" v-if="item.shopId && item.auditFlag == 0">更新资料</button>
  77. <button class="btn" @click="up()" v-if="item.auditFlag == 2">重新提交资料</button>
  78. </view>
  79. </view>
  80. </template>
  81. <script>
  82. export default {
  83. data() {
  84. return {
  85. ip: this.$http.urls.ip,
  86. numList: [{ name: '资料填写' }, { name: '资料审核' }, { name: '审核通过' }],
  87. item: { showPictures: [], auditFlag: -1, pic: [],shopType:2 },
  88. upload: {
  89. header: { apiToken: this.$getUser().apiToken },
  90. name: 'img',
  91. action: this.$http.urls.uploadImg,
  92. size_type: 'compressed ',
  93. count: 5
  94. }
  95. };
  96. },
  97. onLoad(e) {
  98. if (e.item) {
  99. this.item = JSON.parse(e.item);
  100. uni.setNavigationBarTitle({
  101. title: '店铺信息'
  102. });
  103. if (this.item.auditFlag == 2) {
  104. this.numList[2].name = '审核不通过';
  105. uni.setNavigationBarTitle({
  106. title: '重新提交审核'
  107. });
  108. }
  109. }
  110. },
  111. methods: {
  112. //定位
  113. wz(index) {
  114. uni.chooseLocation({
  115. success: r => {
  116. if (index == 1) {
  117. this.item.addres = r.address;
  118. }
  119. this.item.lat = r.latitude;
  120. this.item.lng = r.longitude;
  121. this.$forceUpdate();
  122. }
  123. });
  124. },
  125. up() {
  126. this.item.showPictures = [];
  127. this.item.pic = [];
  128. let pic = this.$refs.pic.lists.filter(val => {
  129. return val.progress == 100;
  130. });
  131. let files = this.$refs.uUpload.lists.filter(val => {
  132. return val.progress == 100;
  133. });
  134. //营业执照
  135. pic.forEach(item => {
  136. if (item.response) {
  137. this.item.pic.push(item.response.fileName); //获取上传成功的网络地址
  138. } else {
  139. this.item.pic.push(item.url); //原来的地址
  140. }
  141. });
  142. //商铺展示图片
  143. files.forEach(item => {
  144. if (item.response) {
  145. this.item.showPictures.push(item.response.fileName); //获取上传成功的网络地址
  146. } else {
  147. this.item.showPictures.push(item.url); //原来的地址
  148. }
  149. });
  150. let rule = [
  151. { name: 'name', checkType: 'notnull', errorMsg: '请输入商铺名称' },
  152. { name: 'addres', checkType: 'notnull', errorMsg: '请输入商铺地址' },
  153. { name: 'bossName', checkType: 'notnull', errorMsg: '请输入负责人' },
  154. { name: 'bossPhone', checkType: 'notnull', errorMsg: '请输入联系电话' },
  155. { name: 'pic', checkType: 'notnull', errorMsg: '请上传营业执照' },
  156. { name: 'showPictures', checkType: 'notnull', errorMsg: '请上传至少1张展示图' }
  157. ];
  158. if (!this.$verify.check(this.item, rule)) {
  159. uni.showModal({ content: this.$verify.error, showCancel: false });
  160. return;
  161. }
  162. this.item.memberId = this.$getUser().memberId;
  163. this.item.showPictures = this.item.showPictures.toString();
  164. this.item.pic = this.item.pic.toString();
  165. this.$http.request({
  166. method: 'POST',
  167. url: this.item.shopId ? this.$http.urls.updateShop : this.$http.urls.shopApply,
  168. data: this.item,
  169. success: res => {
  170. uni.showToast({ title: '提交成功' });
  171. setTimeout(() => {
  172. uni.$emit('shop');
  173. uni.navigateBack();
  174. }, 700);
  175. }
  176. });
  177. }
  178. }
  179. };
  180. </script>
  181. <style lang="scss">
  182. .steps {
  183. text-align: center;
  184. margin-top: 20px;
  185. }
  186. .u-subsection {
  187. margin-top: 20px;
  188. }
  189. .cn {
  190. padding: 15px;
  191. .info {
  192. background-color: white;
  193. border-radius: 5px;
  194. margin-top: 10px;
  195. padding-bottom: 10px;
  196. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  197. .dw {
  198. top: 11px;
  199. font-size: 19px;
  200. right: 9px;
  201. position: absolute;
  202. }
  203. }
  204. textarea {
  205. margin-left: 17px;
  206. font-size: 14px;
  207. padding: 10px;
  208. width: 85%;
  209. height: 85px;
  210. border: 1px solid #f1f1f1;
  211. border-radius: 5px;
  212. }
  213. .btn {
  214. margin-top: 25px;
  215. }
  216. }
  217. .text {
  218. font-size: 11px;
  219. font-weight: normal;
  220. color: $dar;
  221. flex: 0.8;
  222. text-align: right;
  223. }
  224. </style>