information.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473
  1. <template>
  2. <view>
  3. <!-- 胶囊 -->
  4. <mvBar :mysNavConfig="mysNavConfig"></mvBar>
  5. <view :style="{marginTop:navH}"></view>
  6. <view class="basicInfo">
  7. <image :src="mainImg" style="width: 150rpx;height: 150rpx;" mode="">
  8. </image>
  9. <view class="basicInfo_txt">
  10. <p style="margin-bottom: 10rpx;font-size: 36rpx;">{{selection.selection_name}}</p>
  11. <p>售价:¥{{selection.show_estimated_cost}} &nbsp;&nbsp;&nbsp;&nbsp; 佣金:{{selection.commission_rate}}%</p>
  12. <p v-if="selection.task_mode === 1">额外悬赏:¥{{selection.show_task_reward}}</p>
  13. </view>
  14. </view>
  15. <view class="address">
  16. <view>
  17. <image class="address_icon" :src="picture.icon_loc" mode="">
  18. </image>
  19. </view>
  20. <view style="width: 70%;">
  21. <view style="display: flex;">
  22. <p class='ipon' style="padding-right: 100rpx;">{{address.receiver_name}}</p>
  23. <p class='ipon'>{{address.phone_number}}</p>
  24. </view>
  25. <p class='ipon'>{{address.full_detail_addr}}</p>
  26. </view>
  27. <view class="address_edit" @click="editAddress()">
  28. <image :src="picture.icon_edit" mode="">
  29. </image>
  30. </view>
  31. </view>
  32. <view class="keyInfo">
  33. <p style="margin-bottom: 30rpx;font-size: 36rpx;">任务要求</p>
  34. <p>内容形式:{{selection.show_content_type}}</p>
  35. <p>带货链接:{{selection.product_url}}
  36. <image :src="picture.icon_copy" mode="" class="copy-img" @click="handleCopy('123')" />
  37. </p>
  38. <p>领样形式:{{selection.show_sample_mode}}</p>
  39. <p>领样条件:{{selection.sample_condition}}</p>
  40. <p>任务形式:{{selection.show_task_mode}}</p>
  41. <p>返现&悬赏条件:{{selection.reward_condition}}</p>
  42. </view>
  43. <view class="account" @click="editAccount()">
  44. <view class="account_txt">
  45. <image :src="selection.PlatformInfo.platform_icon" mode=""></image>
  46. <span>{{account.platform_nickname}}</span>
  47. </view>
  48. <view class="account_fans">
  49. <p style="padding-right: 20rpx;color:#A8A8A8;">粉丝数</p>
  50. <p>{{account.show_fans_count}}</p>
  51. </view>
  52. <view class="account_btn">
  53. <image :src="picture.togoimg" mode="" style="width: 16rpx;height: 30rpx;"></image>
  54. </view>
  55. </view>
  56. <view class="block"></view>
  57. <view class="submit">
  58. <button type="default" class="submit_btn" @click="submit()"> 确认报名</button>
  59. </view>
  60. </view>
  61. </template>
  62. <script>
  63. import region from '@/components/pca-code.json';
  64. import mvBar from "@/components/mys_navBar/mysNavBar";
  65. import {
  66. fansview
  67. } from '@/components/utils.js';
  68. export default {
  69. components: {
  70. mvBar
  71. },
  72. data() {
  73. return {
  74. navH: getApp().globalData.navHeight,
  75. picture: getApp().globalData.picture,
  76. mysNavConfig: {
  77. isHome: false,
  78. /* 固定导航 */
  79. navFixed: true,
  80. /* 标题 (屏幕中心居中 两边图标中心居中使用slot center1) */
  81. navTitle: {
  82. text: "信息确认",
  83. color: "",
  84. fontSize: "32rpx", // px upx rpx
  85. fontWeight: "", // 100 - 700
  86. },
  87. btnType: "type2",
  88. onLeftClick: '',
  89. /* type2 按钮 */
  90. type2Config: {
  91. // 左图标
  92. leftPath: "https://horastar.obs.cn-east-3.myhuaweicloud.com/talent/png2.png",
  93. // 右图标
  94. rightPath: "https://horastar.obs.cn-east-3.myhuaweicloud.com/talent/png4.png",
  95. // 圆角
  96. radius: "40rpx",
  97. },
  98. },
  99. selection: {},
  100. youngTeamId: "",
  101. youngLeadTeamId: "",
  102. mainImg: "https://horastar.obs.cn-east-3.myhuaweicloud.com/backstage_upload/bb531ede-28b5-49a0-8431-a1608fd35890.png",
  103. account_id: -1,
  104. address_id: -1,
  105. address: null,
  106. project: null,
  107. account: null,
  108. strategy: null,
  109. thirdPlatform: [],
  110. }
  111. },
  112. onShow() {
  113. // 根据address_id查询address
  114. this.getDefaultAddress();
  115. // 查询account
  116. this.getAccount();
  117. },
  118. onLoad(options) {
  119. this.textObj = options.textObj.replace(/""/g, "");
  120. this.textObj = JSON.parse(decodeURIComponent(this.textObj))
  121. console.log(this.textObj)
  122. this.selection = this.textObj.selection
  123. this.youngTeamId = this.textObj.youngTeamId
  124. this.youngLeadTeamId = this.textObj.youngLeadTeamId
  125. for (let i = 0; i < this.selection.Product.ProductPhoto.length; ++i) {
  126. if (this.selection.Product.ProductPhoto[i].Symbol === 1) {
  127. this.mainImg = this.selection.Product.ProductPhoto[i].PhotoUrl
  128. }
  129. }
  130. console.log("youngLeadTeamId: ", this.youngLeadTeamId)
  131. if (this.youngLeadTeamId === "") {
  132. this.getLeadYoungTeamId()
  133. }
  134. },
  135. methods: {
  136. handleCopy(content) {
  137. wx.setClipboardData({
  138. data: content,
  139. success: function(res) {
  140. console.log("复制成功");
  141. }
  142. });
  143. },
  144. getLeadYoungTeamId() {
  145. // 调用后端接口,创建young之团,若young之团存在则返回teamid,否则创建young之团并返回id
  146. return this.$https.post('/youngee/c/t/p/add-young-team', {
  147. selection_id: this.selection.selection_id,
  148. project_type: 2,
  149. })
  150. .then(res => {
  151. console.log(res)
  152. this.youngLeadTeamId = res.data.data;
  153. })
  154. },
  155. getAccount() {
  156. this.$https.get('/youngee/c/t/g/get-talent-account')
  157. .then(res => {
  158. console.log(res)
  159. console.log(res.data.data)
  160. if (res.data.code !== -3) {
  161. let account = res.data.data
  162. while (this.selection == null) {} // 这句很危险
  163. for (var i = 0; i < account.length; i++) {
  164. if (this.selection.platform == account[i].platform_id) {
  165. this.account = account[i]
  166. }
  167. }
  168. this.account.show_fans_count = fansview(this.account.fans_count)
  169. }
  170. })
  171. },
  172. getDefaultAddress() {
  173. this.$https.get('/youngee/c/t/g/get-talent-default-address').then(res => {
  174. console.log(res.data.data)
  175. this.address = res.data.data;
  176. let a = this.address.region_code.toString().slice(0, 2)
  177. let b = this.address.region_code.toString().slice(0, 4)
  178. let c = 0
  179. for (var i = 0; i < region.length; i++) {
  180. if (region[i].code == a) {
  181. a = region[i].name
  182. for (var j = 0; j < region[i].children.length; j++) {
  183. if (region[i].children[j].code == b) {
  184. b = region[i].children[j].name
  185. for (var o = 0; o < region[i].children[j].children.length; o++) {
  186. if (region[i].children[j].children[o].code == this.address
  187. .region_code) {
  188. c = region[i].children[j].children[o].name
  189. }
  190. }
  191. }
  192. }
  193. }
  194. }
  195. this.address.full_detail_addr = a + b + c + this.address.detail_addr
  196. })
  197. },
  198. editAddress() {
  199. uni.navigateTo({
  200. url: '/page_mycenter/myinformation/addlocation?address_id=' + this.address.address_id +
  201. '&ismodify=1'
  202. });
  203. },
  204. editAccount() {
  205. uni.navigateTo({
  206. url: '/page_mycenter/myinformation/bindaccount?platform_id=' + this.account.platform_id +
  207. '&account_id=' +
  208. this.account.account_id
  209. });
  210. },
  211. debugSubmit() {
  212. uni.navigateTo({
  213. url: '/page_tasksquare/wholetask/success'
  214. });
  215. },
  216. // 提交确认报名
  217. async submit() {
  218. console.log(this.project)
  219. // 1. 判断任务是否截止
  220. await this.$https.get('/youngee/c/t/g/get-selection-detail' +
  221. "?" +
  222. "selectionid" +
  223. "=" +
  224. this.selection.selection_id
  225. ).then(res => {
  226. if (res.data.code === 0) {
  227. var newdate = new Date()
  228. var endTime = new Date(this.selection.task_ddl.replace(
  229. /-/g, "/"));
  230. if (endTime - newdate < 0) {
  231. // 招募截止
  232. uni.showToast({
  233. title: "任务已结束",
  234. duration: 1000,
  235. });
  236. uni.navigateTo({
  237. url: '/pages/selectionsquare/selectionsquare'
  238. });
  239. }
  240. }
  241. })
  242. // 2. 插入一条任务
  243. // 如果是垫付买样则进行支付
  244. let that = this
  245. if (this.selection.sample_mode === 2) {
  246. console.log("支付")
  247. this.$https.post('/youngee/c/api/t/wxpay/pay', {
  248. amount: this.selection.price * 100,
  249. description: this.selection.selection_name,
  250. }).then(res => {
  251. console.log(res)
  252. let data = res.data.data
  253. wx.requestPayment({
  254. "timeStamp": data.time_stamp,
  255. "nonceStr": data.nonce_str,
  256. "package": data.package,
  257. "signType": "RSA",
  258. "paySign": data.pay_sign,
  259. "success": function(res) {
  260. // 支付成功时执行
  261. that.$https.post('/youngee/c/t/p/sign-up-sec-task', {
  262. address_id: that.address.address_id,
  263. selection_id: that.selection.selection_id,
  264. lead_team_id: that.youngLeadTeamId,
  265. team_id: that.youngTeamId,
  266. }).then(res => {
  267. if (res.data.code == 0) {
  268. var data = {
  269. task_id: res.data.data.task_id
  270. };
  271. data = JSON.stringify(data)
  272. uni.navigateTo({
  273. url: '/page_selectionsquare/selectiondetail/success?textObj=' +
  274. encodeURIComponent(
  275. data)
  276. });
  277. } else {
  278. uni.showModal({
  279. content: '网络繁忙,请小主稍后再试~',
  280. });
  281. }
  282. })
  283. console.log("支付成功: ", res.errMsg)
  284. },
  285. "fail": function(res) {
  286. // 调起失败或取消支付时执行
  287. console.log("支付失败: ", res.errMsg)
  288. uni.showModal({
  289. content: "支付失败,请重试",
  290. });
  291. },
  292. "complete": function(res) {
  293. // 成功或失败都会执行
  294. console.log("支付结束: ", res.errMsg)
  295. }
  296. })
  297. })
  298. } else {
  299. // 否则直接报名
  300. this.$https.post('/youngee/c/t/p/sign-up-sec-task', {
  301. address_id: this.address.address_id,
  302. selection_id: this.selection.selection_id,
  303. lead_team_id: this.youngLeadTeamId,
  304. team_id: this.youngTeamId,
  305. }).then(res => {
  306. if (res.data.code == 0) {
  307. var data = {
  308. task_id: res.data.data.task_id
  309. };
  310. data = JSON.stringify(data)
  311. uni.navigateTo({
  312. url: '/page_selectionsquare/selectiondetail/success?textObj=' +
  313. encodeURIComponent(
  314. data)
  315. });
  316. } else {
  317. uni.showModal({
  318. content: '网络繁忙,请小主稍后再试~',
  319. });
  320. }
  321. })
  322. }
  323. },
  324. }
  325. }
  326. </script>
  327. <style lang="scss" scoped>
  328. text {
  329. font-size: 32rpx;
  330. }
  331. p {
  332. font-size: 32rpx;
  333. }
  334. .basicInfo {
  335. display: flex;
  336. margin: 0 40rpx;
  337. padding: 30rpx 0;
  338. .basicInfo_txt {
  339. margin-left: 40rpx;
  340. padding-top: 20rpx;
  341. }
  342. }
  343. .address {
  344. display: flex;
  345. margin: 30rpx 40rpx 0;
  346. padding: 30rpx 0;
  347. justify-content: space-around;
  348. .address_icon {
  349. vertical-align: middle;
  350. width: 50rpx;
  351. height: 50rpx;
  352. display: inline-block;
  353. padding-right: 30rpx;
  354. }
  355. .address_edit {}
  356. .address_edit image {
  357. vertical-align: middle;
  358. width: 50rpx;
  359. height: 50rpx;
  360. display: inline-block;
  361. padding-right: 14rpx;
  362. }
  363. .ipon {
  364. color: #333333;
  365. font-size: 30rpx;
  366. margin-bottom: 10rpx;
  367. }
  368. }
  369. .keyInfo {
  370. margin: 30rpx 40rpx;
  371. }
  372. .keyInfo span {
  373. display: flex;
  374. align-items: center;
  375. margin: 10rpx 0;
  376. }
  377. .keyInfo p {
  378. margin: 25rpx 0;
  379. }
  380. .account {
  381. display: flex;
  382. align-items: center;
  383. width: 690rpx;
  384. padding: 24rpx 0;
  385. margin: 0 auto;
  386. .account_txt {
  387. display: inline-block;
  388. padding: 0 0 0 1%;
  389. width: 400rpx;
  390. }
  391. .account_txt span {
  392. color: #333333;
  393. font-weight: 550;
  394. text-indent: 2em;
  395. font-size: 32rpx;
  396. }
  397. .account_txt image {
  398. vertical-align: middle;
  399. width: 50rpx;
  400. height: 50rpx;
  401. display: inline-block;
  402. padding-right: 14rpx;
  403. }
  404. .account_fans {
  405. display: flex;
  406. width: 250rpx;
  407. }
  408. .account_fans p {
  409. display: inline-block;
  410. color: #333333;
  411. font-weight: 550;
  412. }
  413. .account_btn {}
  414. }
  415. .block {
  416. width: 100%;
  417. height: 100rpx;
  418. margin-top: 5%;
  419. }
  420. .submit {
  421. box-shadow: 0rpx 5rpx 40rpx #ccc;
  422. width: 100%;
  423. position: fixed;
  424. bottom: 0rpx;
  425. display: flex;
  426. height: 90rpx;
  427. padding-top: 2%;
  428. background-color: #FFFFFF;
  429. .submit_btn {
  430. width: 60%;
  431. background-color: #FCCF41;
  432. border-radius: 20rpx;
  433. font-size: 36rpx;
  434. line-height: 200%;
  435. letter-spacing: 10rpx;
  436. height: 80%;
  437. }
  438. }
  439. </style>