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.

interestsList.vue 7.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  1. <template>
  2. <view class="content" style="padding: 20rpx;overflow: hidden;padding-bottom: 160rpx;">
  3. <rich-text :nodes="richText">
  4. </rich-text>
  5. <!-- <view @click="addInterestsList(item)" class="ul-item" v-for="(item, index) in state.list" :key="index">
  6. <image style="width: 100%; height: 170rpx; border-radius: 20rpx"
  7. :src="`${$imgUrl}applyCard/product-bg.png`"></image>
  8. <view class="item-value">
  9. <image class="icon-tip"
  10. :src="state.sysType === 'WECHAT'?`${$imgUrl}applyCard/wechat.png` : `${$imgUrl}applyCard/alibaba.png`">
  11. </image>
  12. <view class="content">
  13. <view class="title">
  14. {{ item.productName }}
  15. </view>
  16. </view>
  17. <view class="money">
  18. ¥:{{ item.discountPrice * 0.01 }}
  19. </view>
  20. </view>
  21. </view> -->
  22. </view>
  23. <view class="btn-wrap">
  24. <button type="default" class="button" @click="addInterestsList()">
  25. 下一步
  26. </button>
  27. </view>
  28. </template>
  29. <script setup lang="ts">
  30. import { onLoad, onShow } from "@dcloudio/uni-app";
  31. import { reactive, ref } from "vue";
  32. import { equityProductsApi, equityProductsInfo } from "@/utils/network/api.js";
  33. import { stringToJson } from "@/utils/network/encryption";
  34. import { request } from "@/utils/network/request";
  35. import { fileURL } from "@/datas/fileURL.js";
  36. import navBar from "@/components/nav-bar/nav-bar2.vue";
  37. import navBgCar from "./components/nav-bg-car4";
  38. import { msg, navTo } from "@/utils/utils";
  39. import {
  40. checkOrderStatus,
  41. wechatAppID,
  42. wechatPayConfigId,
  43. wechatSecret,
  44. addProduct,
  45. queryDetails,
  46. getOpenidApi
  47. } from "@/utils/network/api";
  48. import {
  49. getItem,
  50. StorageKeys,
  51. setItem
  52. } from "@/utils/storage";
  53. const imgURL = `${fileURL}image/`;
  54. const state = reactive({
  55. openid: "",
  56. equityId: "",
  57. id: "",
  58. clientFee: "",
  59. list: [], //权益数据
  60. choiceValue: [], //选择的权益数据的下标
  61. choiceValueComplete: [], //选择的权益数据的具体数据
  62. isValueCard: "",
  63. type: 0,
  64. userType: 0,
  65. promoteId: "", //产品id
  66. totalAmount: 0, //产品+权益产品金额
  67. changeCardType: "",//储值卡转记账卡选权益产品
  68. applyId: "",
  69. orderId: "",
  70. sysType: ""
  71. })
  72. let richText = ref('')
  73. onLoad((option : any) => {
  74. console.log("option===", option)
  75. // #ifdef MP-ALIPAY
  76. state.sysType = 'ALI';
  77. // #endif
  78. // #ifdef MP-WEIXIN
  79. state.sysType = 'WECHAT';
  80. // #endif
  81. console.log("promoteId", option)
  82. state.clientFee = option.clientFee;
  83. state.equityId = option.equityId;
  84. state.userType = option.userType;
  85. state.type = option.type;
  86. state.isValueCard = option.isValueCard;
  87. state.promoteId = option.promoteId;
  88. state.totalAmount = option.fee;
  89. // 储值卡转记账卡传过来的参数
  90. state.changeCardType = option.changeCardType;
  91. state.applyId = option.applyId;
  92. state.orderId = option.orderId;
  93. getInfo();
  94. // getList();
  95. getOpenID();
  96. })
  97. const addInterestsList = () => {
  98. // state.totalAmount = Number(state.totalAmount) + Number(item.discountPrice)
  99. if (state.changeCardType == "1") {
  100. navTo(
  101. `/subpackage/after-sale/to-bookkeeping-card/mailing_information?orderId=${state.orderId}&&applyId=${state.applyId}&&productId=${state.promoteId}&&totalAmount=${state.totalAmount}&&equityId=${state.equityId}`
  102. )
  103. } else {
  104. // 正常流程
  105. uni.redirectTo({
  106. url: `/subpackage/orders/essential-information?promoteId=${getItem("promoteId")}&userType=${state.userType}&type=${state.type}&isValueCard=${state.isValueCard}&totalAmount=${state.totalAmount}&equityId=${state.equityId}`,
  107. });
  108. }
  109. }
  110. const getInfo = () => {
  111. const options = {
  112. type: 2,
  113. data: {
  114. "singleEquityId": state.equityId,
  115. },
  116. method: 'POST',
  117. showLoading: true,
  118. }
  119. request(equityProductsInfo, options).then((res) => {
  120. const data = stringToJson(res.bizContent);
  121. console.log("333333", data.productIntro)
  122. richText.value = data.productIntro
  123. })
  124. }
  125. const getList = () => {
  126. const options = {
  127. type: 2,
  128. data: {
  129. "promoteId": state.promoteId,
  130. },
  131. method: 'POST',
  132. showLoading: true,
  133. }
  134. request(equityProductsApi, options).then((res) => {
  135. const data = stringToJson(res.bizContent);
  136. for (var i = 0; i < data.data.length; i++) {
  137. data.data[i]['isShow'] = false;
  138. }
  139. state.list = data.data
  140. console.log("222", data.data)
  141. })
  142. }
  143. const change = (e) => {
  144. console.log(e);
  145. }
  146. //获取微信小程序openid
  147. const getOpenID = () => {
  148. // #ifdef MP-WEIXIN
  149. uni.login({
  150. provider: "weixin",
  151. success: function (e) {
  152. console.log(e);
  153. getOpenid(e.code);
  154. },
  155. });
  156. //#endif
  157. };
  158. const getOpenid = (code) => {
  159. const options = {
  160. type: 2,
  161. data: {
  162. "jsCode": code
  163. },
  164. method: "POST",
  165. showLoading: true,
  166. };
  167. // #ifdef MP-WEIXIN
  168. request(getOpenidApi, options).then((res) => {
  169. const result = stringToJson(res.bizContent);
  170. console.log("获取微信小程序openid", result);
  171. const openidData = stringToJson(result.data);
  172. state.openid = openidData.openid;
  173. setItem("QYorder", state);
  174. });
  175. // #endif
  176. }
  177. const changeIsShow = (index) => {
  178. console.log(index, state.list[index]['isShow'], !state.list[index]['isShow'])
  179. state.list[index]['isShow'] = !state.list[index]['isShow']
  180. console.log("state.list", state.list)
  181. }
  182. const getValue = (value) => {
  183. if (state.choiceValue.length == 0) {
  184. console.log("第一次")
  185. state.choiceValue.push(value)
  186. console.log("state.choiceValue", state.choiceValue)
  187. } else {
  188. var index = state.choiceValue.indexOf(value);
  189. if (index > -1) {//大于0 代表存在,
  190. state.choiceValue.splice(index, 1);//存在就删除
  191. } else {
  192. state.choiceValue.push(value)
  193. }
  194. console.log("state.choiceValue", state.choiceValue)
  195. }
  196. }
  197. </script>
  198. <style scoped lang="scss">
  199. .btn-wrap {
  200. text-align: center;
  201. position: fixed;
  202. bottom: 40rpx;
  203. width: 90%;
  204. left: 5%;
  205. }
  206. .imageDefault {
  207. height: 40rpx;
  208. width: 40rpx;
  209. transform: rotate(270deg);
  210. margin-right: 12rpx;
  211. color: white;
  212. }
  213. .imageChange {
  214. height: 40rpx;
  215. width: 40rpx;
  216. transform: rotate(90deg);
  217. margin-right: 12rpx;
  218. color: white;
  219. }
  220. .item {
  221. width: 90%;
  222. margin: 20rpx auto;
  223. background-color: rgb(41, 199, 207);
  224. border-radius: 20rpx;
  225. padding: 20rpx;
  226. box-sizing: border-box;
  227. color: white;
  228. font-size: 32rpx;
  229. }
  230. .button {
  231. height: 80rpx;
  232. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  233. border-radius: 40rpx;
  234. font-size: 32rpx;
  235. font-weight: 400;
  236. color: #ffffff;
  237. line-height: 80rpx;
  238. }
  239. .item>.title {
  240. width: 100%;
  241. display: flex;
  242. justify-content: space-between;
  243. align-items: center;
  244. }
  245. .children {
  246. margin-left: 50rpx;
  247. margin-top: 16rpx;
  248. }
  249. .children>view {
  250. height: 50rpx;
  251. line-height: 50rpx;
  252. }
  253. .show {
  254. display: inline-block;
  255. }
  256. .hide {
  257. display: none;
  258. }
  259. .ul-item {
  260. // padding: 5px 20rpx;
  261. padding-top: 20rpx;
  262. display: flex;
  263. align-items: center;
  264. .item-value {
  265. padding: 20rpx;
  266. position: absolute;
  267. display: flex;
  268. align-items: center;
  269. width: 80%;
  270. .content {
  271. width: 51%;
  272. .title {
  273. font-size: 32rpx;
  274. font-family: Microsoft YaHei;
  275. font-weight: 400;
  276. color: #ffffff;
  277. }
  278. .tip {
  279. font-size: 24rpx;
  280. font-family: Microsoft YaHei;
  281. font-weight: 400;
  282. color: #ffffff;
  283. }
  284. }
  285. }
  286. .icon-tip {
  287. width: 100rpx;
  288. height: 100rpx;
  289. }
  290. .content {
  291. margin-left: 40rpx;
  292. }
  293. }
  294. .money {
  295. color: white;
  296. }
  297. </style>