becomeShop.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457
  1. <template>
  2. <view class="content">
  3. <image class="shop-banner" src="../../static/images/shop-banner.png" mode="widthFix"></image>
  4. <view class="enterprise">
  5. <view class="enterprise-box">
  6. <view class="box-item">
  7. <view class="item-left">联系人:</view>
  8. <view class="item-right"><input type="text" placeholder="请输入联系人" v-model="nameP" /></view>
  9. </view>
  10. <view class="box-item">
  11. <view class="item-left">联系电话:</view>
  12. <view class="item-right"><input type="text" placeholder="请输入联系电话" v-model="phone" /></view>
  13. </view>
  14. </view>
  15. <view class="enterprise-box">
  16. <view class="box-item">
  17. <view class="item-left">店铺名称:</view>
  18. <view class="item-right"><input type="text" placeholder="请输入店铺名" v-model="name" /></view>
  19. </view>
  20. <!-- <view class="box-item" @click="getLocation"> -->
  21. <view class="box-item">
  22. <view class="item-left">商家地址:</view>
  23. <view class="item-right">
  24. <input type="text" placeholder="请填写详细地址" v-model="showaddress" />
  25. </view>
  26. </view>
  27. <view class="box-item">
  28. <view class="item-left">商户类型:</view>
  29. <view class="item-right">
  30. <picker mode="selector" :range="typeList" range-key='type_name' @change="changeType">
  31. <view>{{type.type_name}}</view>
  32. </picker>
  33. </view>
  34. </view>
  35. <view class="box-item">
  36. <view class="item-left">店铺类型:</view>
  37. <view class="item-right">
  38. <picker mode="selector" :range="classifyList" range-key='category_name'
  39. @change="changeClassify">
  40. <view>{{classify.category_name}}</view>
  41. </picker>
  42. </view>
  43. </view>
  44. </view>
  45. <view class="enterprise-box">
  46. <view class="box-item">
  47. <view class="item-left">身份证:</view>
  48. <view class="item-right"><input type="text" placeholder="请输入身份证" v-model="Idcard" /></view>
  49. </view>
  50. <view class="box-item">
  51. <view class="item-left">店铺简介:</view>
  52. <view class="item-right"><input type="text" placeholder="请输入店铺简介" v-model="introductory" /></view>
  53. </view>
  54. </view>
  55. <view class="enterprise-box">
  56. <view class="box-item">
  57. <view class="item-left">商户账号:</view>
  58. <view class="item-right"><input type="text" placeholder="请输入商户账号" v-model="account" /></view>
  59. </view>
  60. <view class="box-item">
  61. <view class="item-left">商户密码:</view>
  62. <view class="item-right"><input type="password" placeholder="请输入商户密码" v-model="pwd" /></view>
  63. </view>
  64. <view class="box-item">
  65. <view class="item-left">重复密码:</view>
  66. <view class="item-right"><input type="password" placeholder="请重复输入商户密码" v-model="pwdRs" /></view>
  67. </view>
  68. </view>
  69. <view class="enterprise-box">
  70. <view class="box-item1">
  71. <view class="item-left">商户门头:</view>
  72. <view class="item-right">
  73. <image :src="cardimg" mode="" class="upload-img" @click.stop="imgsub" v-if="cardimg">
  74. </image>
  75. <image src="../../static/images/up-img.png" class="upload-img" mode="" v-if="!cardimg"
  76. @click.stop="imgsub"></image>
  77. </view>
  78. </view>
  79. </view>
  80. <view class="enterprise-box">
  81. <view class="box-item1">
  82. <view class="item-left">商户logo:</view>
  83. <view class="item-right">
  84. <image :src="imgY" mode="" class="upload-img" @click.stop="imgsubY" v-if="imgY">
  85. </image>
  86. <image src="../../static/images/up-img.png" class="upload-img" mode="" v-if="!imgY"
  87. @click.stop="imgsubY"></image>
  88. </view>
  89. </view>
  90. </view>
  91. <!-- <view class="enterprise-box">
  92. <view class="box-item">
  93. <view class="item-left">环境介绍:</view>
  94. <view class="item-right"><input type="text" placeholder="请输入" v-model="introductory" /></view>
  95. </view>
  96. <view class="box-item1">
  97. <view class="item-left">店内照片:</view>
  98. <view class="item-right">
  99. <image :src="shopImg" mode="" class="upload-img" @click.stop="imgsub('imgsub')" v-if="shopImg"></image>
  100. <image src="../../static/images/up-img.png" class="upload-img" mode="" v-if="!shopImg" @click.stop="imgsut"></image>
  101. </view>
  102. </view>
  103. </view> -->
  104. </view>
  105. <!-- <view class="flex">
  106. <view class="">
  107. </view>
  108. <view class="">
  109. 我已阅读并同意
  110. </view>
  111. <view class="shopDetail">
  112. 《商户入驻协议》
  113. </view>
  114. </view> -->
  115. <view class="comfirm" @click="comfirm">提交申请</view>
  116. <canvas canvas-id="canvas" v-if="canvasStatus"
  117. :style="{width: canvasWidth + 'px', height: canvasHeight + 'px',position: 'absolute',left:'-100000px',top:'-100000px'}"></canvas>
  118. </view>
  119. </template>
  120. <script>
  121. // import pickerAddress from '@/components/wangding-pickerAddress/wangding-pickerAddress.vue';
  122. import {
  123. mapState,
  124. mapMutations
  125. } from 'vuex';
  126. import {
  127. upload
  128. } from '@/api/order.js';
  129. import {
  130. apply,
  131. gettype,
  132. getclassify
  133. } from '@/api/shop.js';
  134. export default {
  135. // components: {
  136. // pickerAddress
  137. // },
  138. computed: {
  139. ...mapState(['userInfo'])
  140. },
  141. data() {
  142. return {
  143. classify: {
  144. category_name: '请选择店铺类型'
  145. }, //选择的商户分类
  146. classifyList: [], //商户分类列表
  147. type: {
  148. type_name: '请选择商户类型'
  149. }, //选择的商户类型
  150. typeList: [], //商户类型列表
  151. imgY: '', //商户logo
  152. checked: false,
  153. name: '', //店铺名
  154. introductory: '', //简介
  155. Idcard: '', //身份证号码
  156. nameP: '', //联系人
  157. phone: '', //联系人电话
  158. showaddress: '', //详细地址
  159. // addressDetail: '', //省市区
  160. cardimg: '', //商户门头
  161. // latitude: '',
  162. // longitude: '',
  163. account: '', //商户账号
  164. pwd: '', //商户密码
  165. canvasStatus: false,
  166. canvasWidth: '',
  167. canvasHeight: '',
  168. pwdRs: ''
  169. };
  170. },
  171. onShow() {
  172. this.getType();
  173. this.getClassify();
  174. },
  175. methods: {
  176. // 获取商户分类列表
  177. getType() {
  178. gettype().then(({
  179. data
  180. }) => {
  181. this.typeList = data
  182. })
  183. },
  184. // 获取店铺类型列表
  185. getClassify() {
  186. getclassify().then(({
  187. data
  188. }) => {
  189. this.classifyList = data
  190. })
  191. },
  192. changeClassify(e) {
  193. let i = e.detail.value
  194. this.classify = this.classifyList[i]
  195. console.log(this.classify, '123');
  196. },
  197. changeType(e) {
  198. let i = e.detail.value
  199. this.type = this.typeList[i]
  200. },
  201. // 上传门内图片
  202. imgsut() {
  203. // console.log('上传logo');
  204. upload({
  205. filename: ''
  206. }).then(data => {
  207. // console.log('data', data);
  208. this.shopImg = data[0].url;
  209. });
  210. },
  211. // 上传门店logo图片
  212. imgsub() {
  213. // console.log('上传logo');
  214. const obj = this
  215. this.canvasStatus = true
  216. this.$util.uploadImageChange('upload/image', function(res) {
  217. obj.cardimg = res.data.url;
  218. }, (res) => {
  219. this.canvasStatus = false
  220. }, (res) => {
  221. this.canvasWidth = res.w
  222. this.canvasHeight = res.h
  223. });
  224. },
  225. // 上传营业执照图片
  226. imgsubY() {
  227. const obj = this
  228. // console.log('i上传营业执照');
  229. this.$util.uploadImageChange('upload/image', function(res) {
  230. obj.imgY = res.data.url;
  231. console.log(obj.imgY, '12345');
  232. }, (res) => {
  233. this.canvasStatus = false
  234. }, (res) => {
  235. this.canvasWidth = res.w
  236. this.canvasHeight = res.h
  237. });
  238. },
  239. check() {
  240. this.checked = !this.checked;
  241. },
  242. // getLocation() {
  243. // console.log('选择当前位置');
  244. // let obj = this;
  245. // uni.chooseLocation({
  246. // success: function(res) {
  247. // obj.latitude = res.latitude;
  248. // obj.longitude = res.longitude;
  249. // if (res.address) {
  250. // obj.showaddress = res.address;
  251. // } else {
  252. // obj.showaddress = res.name;
  253. // }
  254. // }
  255. // });
  256. // },
  257. // 选中城市切换
  258. onCityClick({
  259. data
  260. }) {
  261. this.addressDetail = data.join(',');
  262. },
  263. // 提交申请
  264. comfirm() {
  265. const obj = this;
  266. if (obj.name == '') {
  267. obj.$api.msg('请输入店铺名');
  268. return;
  269. }
  270. if (obj.classify.category_name == '请选择店铺类型') {
  271. obj.$api.msg('请选择店铺类型');
  272. return;
  273. }
  274. if (obj.type.type_name == '请选择商户类型') {
  275. obj.$api.msg('请选择商户类型');
  276. return;
  277. }
  278. if (obj.introductory == '') {
  279. obj.$api.msg('请输入您的商铺简介');
  280. return;
  281. }
  282. if (obj.Idcard == '') {
  283. obj.$api.msg('请输入身份证号');
  284. return;
  285. }
  286. if (obj.nameP == '') {
  287. obj.$api.msg('请输入联系人');
  288. return;
  289. }
  290. if (obj.phone == '') {
  291. obj.$api.msg('请输入联系人电话');
  292. return;
  293. }
  294. if (obj.showaddress == '') {
  295. obj.$api.msg('请选择详细地址');
  296. return;
  297. }
  298. if (obj.cardimg == '') {
  299. obj.$api.msg('请上传门头照片');
  300. return;
  301. }
  302. if (obj.imgY == '') {
  303. obj.$api.msg('请上传营业执照');
  304. return;
  305. }
  306. if (obj.account == '') {
  307. obj.$api.msg('请填写商户账号');
  308. return;
  309. }
  310. if (obj.pwd == '') {
  311. obj.$api.msg('请填写商户密码');
  312. return;
  313. }
  314. if (obj.pwd != obj.pwdRs) {
  315. obj.$api.msg('重复密码输入不相同请重新输入');
  316. return;
  317. }
  318. apply({
  319. mer_name: obj.name,
  320. category_id: obj.classify.merchant_category_id,
  321. type_id: obj.type.mer_type_id,
  322. name: obj.nameP,
  323. account: obj.account,
  324. pwd: obj.pwd,
  325. phone: obj.phone,
  326. mer_address: obj.showaddress,
  327. Idcard: obj.Idcard,
  328. introduction: obj.introductory,
  329. image: obj.imgY,
  330. shopImg: obj.cardimg
  331. })
  332. .then(e => {
  333. uni.showToast({
  334. title: '申请成功,请耐心等待审核',
  335. icon: 'success',
  336. duration: 2000
  337. });
  338. })
  339. .catch(function(e) {
  340. console.log('出错了');
  341. console.log(e);
  342. });
  343. }
  344. }
  345. };
  346. </script>
  347. <style lang="scss">
  348. .content {}
  349. .shop-banner {
  350. width: 750rpx;
  351. }
  352. .enterprise {
  353. padding: 30rpx;
  354. }
  355. .enterprise-box {
  356. background-color: #ffffff;
  357. border-radius: 12rpx;
  358. width: 100%;
  359. margin-bottom: 30rpx;
  360. .box-item {
  361. display: flex;
  362. border-bottom: 1rpx solid #f0f0f0;
  363. padding: 32rpx 24rpx;
  364. align-items: center;
  365. &:nth-last-child(1) {
  366. border-bottom: none;
  367. }
  368. }
  369. .item-left {
  370. font-size: 28rpx;
  371. width: 160rpx;
  372. flex-shrink: 0;
  373. }
  374. .item-right {
  375. width: 100%;
  376. margin-left: 24rpx;
  377. font-size: 28rpx;
  378. display: flex;
  379. align-items: center;
  380. color: #999999;
  381. input {
  382. font-size: 28rpx;
  383. }
  384. image {
  385. width: 160rpx;
  386. height: 160rpx;
  387. margin-top: 24rpx;
  388. margin-left: 60rpx;
  389. }
  390. }
  391. .box-item1 {
  392. display: flex;
  393. border-bottom: 1rpx solid #f0f0f0;
  394. padding: 32rpx 24rpx;
  395. // align-items: center;
  396. &:nth-last-child(1) {
  397. border-bottom: none;
  398. }
  399. }
  400. }
  401. .comfirm {
  402. margin: 20rpx auto 0;
  403. width: 750rpx;
  404. height: 80rpx;
  405. background: #681445;
  406. display: flex;
  407. justify-content: center;
  408. align-items: center;
  409. color: #ffffff;
  410. font-size: 36rpx;
  411. }
  412. .comfirm1 {
  413. margin: 0 auto;
  414. border-radius: 80rpx;
  415. width: 650rpx;
  416. height: 100rpx;
  417. background: #b1b1b1;
  418. display: flex;
  419. justify-content: center;
  420. align-items: center;
  421. color: #ffffff;
  422. font-size: 36rpx;
  423. }
  424. .checkbox {
  425. font-size: 32rpx;
  426. color: #eeeeee;
  427. background: #eeeeee;
  428. border-radius: 50px;
  429. }
  430. .checked {
  431. color: #fd4343;
  432. background: #ffffff;
  433. }
  434. .radio {
  435. padding-top: 5rpx;
  436. margin-right: 15rpx;
  437. }
  438. </style>