青蛙卖大米小程序2024-11-24
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

350 lines
7.1 KiB

4 months ago
  1. <template>
  2. <view class="applyLaundryStore">
  3. <navbar title="渠道合作" leftClick @leftClick="$utils.navigateBack" />
  4. <view class="frame">
  5. <view class="title">
  6. <span
  7. style="width: 10rpx;height: 40rpx;background-color: #f78142;border-radius: 10rpx;overflow: hidden;"></span>
  8. <span>申请信息</span>
  9. </view>
  10. <view class="shopName">
  11. <view>类型</view>
  12. <view>
  13. <uv-radio-group v-model="form.type">
  14. <uv-radio
  15. v-for="(item, index) in typeList"
  16. :key="index"
  17. :customStyle="{margin: '16rpx'}"
  18. size="40rpx"
  19. iconSize="30rpx"
  20. labelSize="30rpx"
  21. :disabled="isUpdate"
  22. :label="item.name"
  23. :name="item.type">
  24. </uv-radio>
  25. </uv-radio-group>
  26. </view>
  27. </view>
  28. <view class="shopName">
  29. <view style="width: 300rpx;"
  30. v-if="form.type">身份证</view>
  31. <view style="width: 300rpx;"
  32. v-else>营业执照</view>
  33. <view>
  34. <uv-upload
  35. :fileList="fileList"
  36. name="fileList"
  37. :maxCount="2"
  38. width="180rpx"
  39. height="180rpx"
  40. :disabled="isUpdate"
  41. multiple
  42. @afterRead="afterRead"
  43. @delete="deleteImage">
  44. </uv-upload>
  45. </view>
  46. </view>
  47. <view class="shopName">
  48. <view>姓名</view>
  49. <view>
  50. <input v-model="form.name"
  51. :disabled="isUpdate" placeholder="请输入姓名" clearable></input>
  52. </view>
  53. </view>
  54. <view class="shopName">
  55. <view>性别</view>
  56. <view>
  57. <uv-radio-group v-model="form.sex">
  58. <uv-radio
  59. v-for="(item, index) in sexList"
  60. :key="index"
  61. :customStyle="{margin: '16rpx'}"
  62. size="40rpx"
  63. iconSize="30rpx"
  64. :disabled="isUpdate"
  65. labelSize="30rpx"
  66. :label="item.name"
  67. :name="item.name">
  68. </uv-radio>
  69. </uv-radio-group>
  70. </view>
  71. </view>
  72. <view class="shopName">
  73. <view>手机号</view>
  74. <view>
  75. <input v-model="form.phone"
  76. :disabled="isUpdate" type="number" placeholder="请输入手机号" clearable></input>
  77. </view>
  78. </view>
  79. <view class="shopName" v-if="form.type">
  80. <view>身份证号</view>
  81. <view>
  82. <input v-model="form.no"
  83. :disabled="isUpdate" placeholder="请输入身份证号" clearable></input>
  84. </view>
  85. </view>
  86. <view class="shopName" v-else>
  87. <view>社会信用代码</view>
  88. <view>
  89. <input v-model="form.no"
  90. :disabled="isUpdate" placeholder="请输入社会信用统一代码" clearable></input>
  91. </view>
  92. </view>
  93. <view class="shopName">
  94. <view>邮寄地址</view>
  95. <view>
  96. <input v-model="form.address"
  97. :disabled="isUpdate" placeholder="请输入邮寄地址" clearable></input>
  98. </view>
  99. </view>
  100. </view>
  101. <view class="config">
  102. <uv-checkbox-group
  103. v-model="checkboxValue"
  104. shape="circle">
  105. <view class="content">
  106. <view
  107. style="display: flex;">
  108. <uv-checkbox
  109. size="40rpx"
  110. icon-size="30rpx"
  111. activeColor="#A3D250"
  112. :name="1"
  113. ></uv-checkbox>
  114. 阅读并同意我们的<text @click="$refs.popup.open('shop_user_xy')">合作协议</text>
  115. </view>
  116. </view>
  117. </uv-checkbox-group>
  118. </view>
  119. <!-- 底部按钮 -->
  120. <view class="uni-color-btn"
  121. @click="submitApplication"
  122. v-if="!isUpdate">
  123. 提交
  124. </view>
  125. <configPopup ref="popup"></configPopup>
  126. </view>
  127. </template>
  128. <script>
  129. import Position from '@/utils/position.js'
  130. export default {
  131. components: {
  132. },
  133. data() {
  134. return {
  135. checkboxValue : [],
  136. form: {
  137. userName: '',
  138. name: '',
  139. phone: '',
  140. sex : '男',
  141. type : 0,
  142. state : 0,
  143. },
  144. fileList: [],
  145. sexList : [
  146. {
  147. name: '男',
  148. },
  149. {
  150. name: '女',
  151. },
  152. ],
  153. typeList : [
  154. {
  155. name: '企业',
  156. type : 0,
  157. },
  158. {
  159. name: '个人',
  160. type : 1,
  161. },
  162. ],
  163. }
  164. },
  165. computed: {
  166. isUpdate(){
  167. return this.form.state == 1
  168. },
  169. },
  170. onShow() {
  171. },
  172. onLoad() {
  173. this.getData()
  174. },
  175. methods: {
  176. deleteImage(e){
  177. this[e.name].splice(e.index, 1)
  178. },
  179. afterRead(e){
  180. let self = this
  181. e.file.forEach(file => {
  182. self.$Oss.ossUpload(file.url).then(url => {
  183. self[e.name].push({
  184. url
  185. })
  186. })
  187. })
  188. },
  189. // 提交按钮
  190. submitApplication() {
  191. if(!this.checkboxValue.length){
  192. return uni.showToast({
  193. title: '请先同意合作协议',
  194. icon:'none'
  195. })
  196. }
  197. this.form.image = this.fileList.map((item) => item.url).join(",")
  198. let p = {
  199. image: '请上传店铺照片',
  200. name: '请输入您的姓名',
  201. phone: '请输入联系电话',
  202. no: '请输入社会信用代码',
  203. address: '请输入邮寄地址',
  204. }
  205. if(this.form.type){
  206. p.no = '请输入身份证号'
  207. }
  208. if (this.$utils.verificationAll(this.form, p)) {
  209. return
  210. }
  211. if(!this.$utils.verificationPhone(this.form.phone)){
  212. return uni.showToast({
  213. title: '手机号格式不正确',
  214. icon:'none'
  215. })
  216. }
  217. this.$api('addOrUpdateCommonUser', this.form, res => {
  218. if (res.code == 200) {
  219. uni.showToast({
  220. title: '申请成功待审核', // 提示的内容
  221. icon: 'success', // 图标,可选值有 'success', 'loading', 'none'
  222. duration: 1500 // 提示的持续时间,默认是1500毫秒
  223. });
  224. setTimeout(uni.navigateBack, 1000, -1)
  225. }
  226. })
  227. },
  228. getData(){
  229. this.$api('getCommonUser', res => {
  230. if(res.code == 200){
  231. this.form = res.result
  232. delete this.form.userId
  233. delete this.form.createTime
  234. delete this.form.createBy
  235. delete this.form.state
  236. delete this.form.updateBy
  237. delete this.form.updateTime
  238. res.result.image && res.result.image.split(',')
  239. .forEach(url => {
  240. this.fileList.push({
  241. url
  242. })
  243. })
  244. }
  245. })
  246. },
  247. }
  248. }
  249. </script>
  250. <style lang="scss" scoped>
  251. * {
  252. box-sizing: border-box;
  253. }
  254. .applyLaundryStore {
  255. padding: 0 20rpx 0 20rpx;
  256. background-color: #f5f5f5;
  257. .frame {
  258. display: flex;
  259. flex-direction: column;
  260. gap: 20rpx;
  261. background-color: #FFF;
  262. margin-top: 20rpx;
  263. padding: 20rpx;
  264. .title {
  265. display: flex;
  266. // padding-top: 40rpx;
  267. font-size: 34rpx;
  268. font-weight: 700;
  269. padding: 0 0 0 20rpx;
  270. >span:nth-of-type(1) {
  271. margin: 4rpx 0 0 8rpx;
  272. background-color: #FFF;
  273. }
  274. >span:nth-of-type(2) {
  275. margin: 0 0 0 8rpx;
  276. background-color: #FFF;
  277. }
  278. }
  279. .shopName {
  280. display: flex;
  281. align-items: center;
  282. background-color: #FFF;
  283. // margin: 10rpx 0 0 0;
  284. padding: 10rpx 0 0 20rpx;
  285. >view:nth-of-type(1) {
  286. width: 30%;
  287. // font-weight: 700;
  288. }
  289. >view:nth-of-type(2) {
  290. width: 70%;
  291. // padding: 0 20rpx 0 0;
  292. border-radius: 10rpx;
  293. overflow: hidden;
  294. input {
  295. background-color: #f5f5f5;
  296. // color: #a4a4a4;
  297. font-size: 28rpx;
  298. padding: 8rpx 8rpx 8rpx 15rpx;
  299. }
  300. }
  301. }
  302. }
  303. .config{
  304. font-size: 26rpx;
  305. padding: 20rpx;
  306. /deep/ .uv-checkbox-group{
  307. display: flex;
  308. justify-content: center;
  309. }
  310. text{
  311. color: $uni-color;
  312. }
  313. }
  314. }
  315. </style>