field-pane-uua.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397
  1. <template>
  2. <view class="field-pane-container">
  3. <view style="position: relative;">
  4. <JHeader
  5. :title="relationLevelName ? `${relationLevelName}升级` : title" width="50" height="50" :dark="false"
  6. style="position: absolute;top: 0;left: 0;z-index: 1;width: 100%;padding: 24upx 0 0;color: #ffffff;"
  7. >
  8. </JHeader>
  9. <image
  10. src="../../../../static/images/user/activity/upgrade-pic.png"
  11. style="width: 750upx;height: 413upx;vertical-align: bottom;"
  12. >
  13. </image>
  14. <view style="position: absolute;top: 260upx;left: 64upx;">
  15. <view v-if="[1, 2, 3, 4].includes(upgradeLevelType) && relationshipLevelName">
  16. <view style="font-size: 48upx;color: #ffffff;">升级{{ relationshipLevelName }}</view>
  17. <view style="margin-top: 10upx;font-size: 28upx;color: #BBBABF;">
  18. <text v-if="relationshipLevelName === '团长'">购买指定商品</text>
  19. <text v-else-if="relationshipLevelName === '合伙人'">邀请团长</text>
  20. <text v-else>填写表单</text>
  21. </view>
  22. </view>
  23. <view v-else-if="[ 5 ].includes(upgradeLevelType)">
  24. <view style="font-size: 48upx;color: #ffffff;">合伙人</view>
  25. </view>
  26. <view v-else>
  27. <view style="font-size: 48upx;color: #ffffff;">升级</view>
  28. <view style="margin-top: 10upx;font-size: 28upx;color: #BBBABF;">填写表单</view>
  29. </view>
  30. </view>
  31. </view>
  32. <view style="padding: 36upx 24upx;background-color: #ffffff;">
  33. <view style="padding: 20upx 18upx;background-color: #f5f4fb;">
  34. <view style="display: flex;justify-content: space-between;align-items: center;">
  35. <view style="display: flex;align-items: center;">
  36. <BeeIcon :size="30" :src="common.seamingImgUrl(userInfo.headImage)"></BeeIcon>
  37. <view style="margin-left: 20upx;color: #222229;">{{ userInfo.name || userInfo.wechatName || '--' }}</view>
  38. </view>
  39. <view style="font-size: 28upx;color: #533A23;">
  40. <text v-if="[1, 2, 3, 4].includes(upgradeLevelType) && relationshipLevelName">
  41. {{ relationshipLevelName }}升级
  42. </text>
  43. <view v-else-if="[ 5 ].includes(upgradeLevelType)">-</view>
  44. <text v-else>不可升级</text>
  45. </view>
  46. </view>
  47. <view style="margin-top: 20upx;font-size: 24upx;color: #9E9E9E;">
  48. <text v-if="[2, 4].includes(upgradeLevelType)">已满足申请条件</text>
  49. <text v-else-if="[ 5 ].includes(upgradeLevelType)">恭喜您已经是合伙人</text>
  50. <text v-else-if="[0, 1, 3].includes(upgradeLevelType)">不满足角色的升级条件</text>
  51. <text v-else>无法获取信息,请重试!</text>
  52. </view>
  53. </view>
  54. <view v-if="isShowLock" style="margin-top: 76upx;">
  55. <view v-if="[1, 2, 3, 4].includes(upgradeLevelType)" style="text-align: center;">
  56. <tui-button
  57. type="warning" width="680upx" height="104upx" margin="20upx 0"
  58. style="display: inline-block;font-weight: bold;color: #F5CEA8;background: #2C2B30!important;border-radius: 10upx;"
  59. @click="handleClickUnlock"
  60. >
  61. {{ relationLevelName ? '立刻升级' : '立即升级' }}
  62. </tui-button>
  63. </view>
  64. </view>
  65. <view v-else>
  66. <view style="font-weight: bold;margin-top: 36upx;">填写申请信息</view>
  67. <view style="padding: 0 10upx;">
  68. <view v-for="item in fields" :key="item.label">
  69. <view v-if="item.field === 'id'"></view>
  70. <view v-else-if="item.field === 'region'" class="item">
  71. <view
  72. class="input-wrapper" :style="{
  73. 'flex-direction': item.type === 'textarea' ? 'column' : '',
  74. 'align-items': item.type === 'textarea' ? 'flex-start' : ''
  75. }"
  76. >
  77. <view class="sub-title">{{ item.label }}</view>
  78. <view class="region-select" style="flex: 1;">
  79. <!-- 区代理:三级任何。团长:四级最后。其它:四级任何 -->
  80. <!-- 5区代理,4加盟商,3合伙人,2团长,1会员 -->
  81. <JArea
  82. v-if="item.type === 'area' && item.field === 'region'" style="flex: 1;"
  83. :text="regionName || (form.region ? `已选 ID:${form.region}` : '')" :placeholder="item.placeholder"
  84. @confirm="handleSelectRegionArea"
  85. >
  86. </JArea>
  87. </view>
  88. </view>
  89. </view>
  90. <view v-else-if="item.field === 'relationshipLevelId'" class="item">
  91. <view
  92. class="input-wrapper" :style="{
  93. 'flex-direction': item.type === 'textarea' ? 'column' : '',
  94. 'align-items': item.type === 'textarea' ? 'flex-start' : ''
  95. }"
  96. >
  97. <view class="sub-title">{{ item.label }}</view>
  98. <view v-if="item.type === 'select'" style="flex: 1;text-align: right;">
  99. <view v-if="form.region">
  100. <view
  101. v-if="item.type === 'select' && item.field === 'relationshipLevelId'" :style="{
  102. color: form.relationshipLevelId ? '' : '#999'
  103. }" @click="isShowRelationshipLevelSelect = true"
  104. >
  105. {{ relationshipLevelName || (form.relationshipLevelId ? `已选 ID:${form.relationshipLevelId}`
  106. : item.placeholder) }}
  107. </view>
  108. </view>
  109. <view v-else :style="{ color: relationshipLevelName ? '' : '#999' }" @click="$showToast('请先选择所在区域')">
  110. {{ relationshipLevelName || item.placeholder }}
  111. </view>
  112. </view>
  113. </view>
  114. </view>
  115. <view v-else-if="item.field === 'address'" class="item">
  116. <view
  117. class="input-wrapper" style="position: relative;flex-direction: column;align-items: flex-start;"
  118. >
  119. <view class="sub-title">{{ item.label }}</view>
  120. <textarea
  121. v-if="item.type === 'textarea'" :value="form[item.field]" class="textarea"
  122. :placeholder="item.placeholder" @input="handleInput(item.field, $event)"
  123. ></textarea>
  124. <tui-icon
  125. name="position" :size="35" unit="upx" color="#999999"
  126. style="position: absolute;right: 20upx;bottom: 20upx;"
  127. @click="handleClickPosition"
  128. ></tui-icon>
  129. </view>
  130. </view>
  131. <view v-else class="item">
  132. <template>
  133. <view
  134. class="input-wrapper" :style="{
  135. 'flex-direction': item.type === 'textarea' ? 'column' : '',
  136. 'align-items': item.type === 'textarea' ? 'flex-start' : ''
  137. }"
  138. >
  139. <view class="sub-title">{{ item.label }}</view>
  140. <input
  141. v-if="item.type === 'input'" :value="form[item.field]" class="input" :disabled="false"
  142. :type="item.field === 'phone' ? 'number' : 'text'" :placeholder="item.placeholder"
  143. placeholder-style="text-align: right;" @input="handleInput(item.field, $event)"
  144. />
  145. <textarea
  146. v-if="item.type === 'textarea'" :value="form[item.field]" class="textarea"
  147. :placeholder="item.placeholder" @input="handleInput(item.field, $event)"
  148. ></textarea>
  149. </view>
  150. </template>
  151. </view>
  152. </view>
  153. </view>
  154. </view>
  155. </view>
  156. <!-- 会员类型 -->
  157. <tui-select
  158. :list="relationshipLevelList" reverse :show="isShowRelationshipLevelSelect"
  159. @confirm="handleSelectRelationshipLevelList" @close="isShowRelationshipLevelSelect = false"
  160. ></tui-select>
  161. </view>
  162. </template>
  163. <script>
  164. import { getPlatformRelationshipLevelApi, getSelectLevelPlatformRelationApi, getSelectApplyPlatformRelationApi } from '../../../../api/anotherTFInterface'
  165. export default {
  166. name: 'FieldPaneUUA',
  167. props: {
  168. fields: {
  169. type: Array,
  170. required: true
  171. },
  172. value: {
  173. type: Object,
  174. required: true
  175. },
  176. title: String,
  177. userInfo: {
  178. type: Object,
  179. default: () => ({})
  180. }
  181. },
  182. data() {
  183. return {
  184. form: {},
  185. upgradeLevelType: '',
  186. relationLevelName: '', // 如果有值则一定满足条件,空字符串则不满足任何条件(默认),null则为请求失败
  187. isShowLock: true,
  188. relationshipLevelList: [],
  189. isShowRelationshipLevelSelect: false,
  190. relationshipLevelName: '', // 如果有值,但不一定满足条件
  191. regionName: ''
  192. }
  193. },
  194. watch: {
  195. fields: {
  196. handler(value) {
  197. if (value) {
  198. const form = {}
  199. for (const item of value) {
  200. form[item.field] = this.value[item.field]
  201. }
  202. this.form = form
  203. }
  204. },
  205. immediate: true,
  206. deep: true
  207. },
  208. form: {
  209. handler(value) {
  210. this.$emit('input', value)
  211. },
  212. immediate: true,
  213. deep: true
  214. }
  215. },
  216. created() {
  217. this.handleInitUpgradeInfo()
  218. },
  219. methods: {
  220. handleInitUpgradeInfo() {
  221. uni.showLoading()
  222. getSelectLevelPlatformRelationApi({})
  223. .then((res) => {
  224. this.upgradeLevelType = res.data ? res.data.levelType : ''
  225. if (res.data && res.data.levelType === 1) {
  226. this.relationshipLevelName = '团长'
  227. } else if (res.data && res.data.levelType === 2) {
  228. this.relationLevelName = '团长'
  229. this.relationshipLevelName = '团长'
  230. } else if (res.data && res.data.levelType === 3) {
  231. this.relationshipLevelName = '合伙人'
  232. } else if (res.data && res.data.levelType === 4) {
  233. this.relationLevelName = '合伙人'
  234. this.relationshipLevelName = '合伙人'
  235. } else if (res.data && res.data.levelType === 5) { // 已经是合伙人
  236. this.relationLevelName = ''
  237. } else if (res.data && res.data.levelType === 0) {
  238. this.relationLevelName = ''
  239. }
  240. // this.upgradeLevelType = 0
  241. // this.relationLevelName = ''
  242. // this.relationshipLevelName = ''
  243. uni.hideLoading()
  244. })
  245. .catch((e) => {
  246. this.relationLevelName = null
  247. uni.hideLoading()
  248. })
  249. },
  250. handleClickUnlock() {
  251. if (this.relationLevelName) {
  252. this.$emit('unlock')
  253. this.isShowLock = false
  254. if (this.upgradeLevelType === 2) {
  255. // if (this.$store.state.location.locationInfo.towncode) {
  256. // this.form.address = this.$store.state.location.detailAddress || ''
  257. // this.form.region = this.$store.state.location.locationInfo.towncode || ''
  258. // this.form.regionName = (this.$store.state.location.locationInfo.province + this.$store.state.location.locationInfo.city + this.$store.state.location.locationInfo.district + this.$store.state.location.locationInfo.township) || ''
  259. // }
  260. } else if (this.upgradeLevelType === 4) {
  261. getSelectApplyPlatformRelationApi({})
  262. .then((res) => {
  263. if (res.data && res.data.applyId) {
  264. // this.$showToast('已存在申请')
  265. this.form.region = res.data.region
  266. this.form.address = res.data.address
  267. this.form.name = res.data.name
  268. this.form.phone = res.data.phone
  269. this.getPlatformRelationshipLevelList(this.form.region)
  270. }
  271. })
  272. }
  273. } else if (this.upgradeLevelType === 1) {
  274. this.go('/another-tf/another-user/user-upgrade/purchase-chain-products')
  275. } else if (this.upgradeLevelType === 3) {
  276. uni.showModal({
  277. title: '您当前合伙人条件未达到!',
  278. content: '仅需名下有3名团长,\n即可升级合伙人!',
  279. showCancel: false,
  280. confirmText: '确定',
  281. success: (res) => {
  282. }
  283. })
  284. } else {
  285. // this.$showToast('其它情况')
  286. }
  287. },
  288. handleSelectRegionArea(e) {
  289. this.regionName = e.area
  290. this.form.region = e.county.id || e.city.id || e.province.id
  291. this.getPlatformRelationshipLevelList(this.form.region)
  292. },
  293. getPlatformRelationshipLevelList(manageArea) {
  294. uni.showLoading()
  295. getPlatformRelationshipLevelApi({ manageArea })
  296. .then((res) => {
  297. this.relationshipLevelList = res.data.filter((item) => item.levelName !== '会员').map((item) => ({
  298. ...item,
  299. value: item.levelNum,
  300. text: item.levelName
  301. }))
  302. if (!this.relationshipLevelList.length) {
  303. this.relationLevelName = ''
  304. this.relationshipLevelName = ''
  305. this.form.relationshipLevelId = ''
  306. } else {
  307. this.relationshipLevelName = this.relationshipLevelList[0].levelName
  308. this.form.relationshipLevelId = this.relationshipLevelList[0].relationshipLevelId
  309. }
  310. uni.hideLoading()
  311. })
  312. .catch((e) => {
  313. uni.hideLoading()
  314. })
  315. },
  316. handleSelectRelationshipLevelList(e) {
  317. console.log(e)
  318. this.isShowRelationshipLevelSelect = false
  319. this.relationshipLevelName = e.options.text
  320. this.form.relationshipLevelId = e.options.value
  321. },
  322. handleInput(field, e) {
  323. console.log(field, e)
  324. if (field === 'address' || field === 'phone' || field === 'name') {
  325. this.form[field] = e.detail.value
  326. }
  327. },
  328. handleClickPosition() {
  329. if (!this.$store.state.location.detailAddress) return this.$showToast('定位失败')
  330. this.form.address = this.$store.state.location.detailAddress
  331. }
  332. }
  333. }
  334. </script>
  335. <style lang="less" scoped>
  336. @import "../../../../style/var.less";
  337. @import "../../../../style/mixin.less";
  338. .field-pane-container {
  339. // margin-top: 30upx;
  340. .title {
  341. font-size: @f14;
  342. color: #fa5151;
  343. font-weight: bold;
  344. }
  345. .item {
  346. padding: 20upx 0;
  347. // border-bottom: 1upx solid #d8d8d8;
  348. margin-top: 20upx;
  349. .region-select {
  350. /deep/ .value {
  351. text-align: right;
  352. }
  353. }
  354. .input-wrapper {
  355. .flex();
  356. font-size: 30upx;
  357. color: @c3d;
  358. .sub-title {
  359. margin-right: 20upx;
  360. font-weight: bold;
  361. }
  362. /deep/ .uni-input-placeholder,
  363. /deep/ .uni-textarea-placeholder {
  364. font-size: 30upx;
  365. color: @c9;
  366. }
  367. .input {
  368. flex: 1;
  369. font-size: @f12;
  370. }
  371. .textarea {
  372. margin-top: 20upx;
  373. width: 100%;
  374. height: 40px;
  375. font-size: 24upx;
  376. }
  377. }
  378. }
  379. }
  380. </style>