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.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. <template>
  2. <view class="content" style="padding: 20rpx;overflow: hidden;">
  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 style="align-items: center;text-align: center;padding 20rpx;position: absolute;bottom: 40rpx;width: 90%;left: 5%;" >
  24. <button type="default" class="button" @click="addInterestsList(item)" v-for="(item, index) in state.list" :key="index">
  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. // #ifdef MP-ALIPAY
  75. state.sysType = 'ALI';
  76. // #endif
  77. // #ifdef MP-WEIXIN
  78. state.sysType = 'WECHAT';
  79. // #endif
  80. console.log("promoteId", option)
  81. state.clientFee = option.clientFee;
  82. state.equityId = option.equityId;
  83. state.userType = option.userType;
  84. state.type = option.type;
  85. state.isValueCard = option.isValueCard;
  86. state.promoteId = option.promoteId;
  87. state.totalAmount = option.fee;
  88. // 储值卡转记账卡传过来的参数
  89. state.changeCardType = option.changeCardType;
  90. state.applyId = option.applyId;
  91. state.orderId = option.orderId;
  92. getInfo();
  93. getList();
  94. getOpenID();
  95. //equityProductsInfo
  96. console.log("option", option)
  97. })
  98. const addInterestsList = (item) => {
  99. console.log("item", item)
  100. state.totalAmount = Number(state.totalAmount) + Number(item.discountPrice)
  101. if (state.changeCardType == "1") {
  102. navTo(
  103. `/subpackage/after-sale/to-bookkeeping-card/mailing_information?orderId=${state.orderId}&&applyId=${state.applyId}&&productId=${state.promoteId}&&totalAmount=${state.totalAmount}&&equityId=${item.equityId}`
  104. )
  105. } else {
  106. // 正常流程
  107. uni.redirectTo({
  108. url: `/subpackage/orders/essential-information?promoteId=${getItem("promoteId")}&userType=${state.userType}&type=${state.type}&isValueCard=${state.isValueCard}&totalAmount=${state.totalAmount}&equityId=${item.equityId}`,
  109. });
  110. }
  111. }
  112. const getInfo = () => {
  113. const options = {
  114. type: 2,
  115. data: {
  116. "singleEquityId": state.equityId,
  117. },
  118. method: 'POST',
  119. showLoading: true,
  120. }
  121. request(equityProductsInfo, options).then((res) => {
  122. const data = stringToJson(res.bizContent);
  123. console.log("333333", data.productIntro)
  124. richText.value = data.productIntro
  125. })
  126. }
  127. const getList = () => {
  128. const options = {
  129. type: 2,
  130. data: {
  131. "promoteId": state.promoteId,
  132. },
  133. method: 'POST',
  134. showLoading: true,
  135. }
  136. request(equityProductsApi, options).then((res) => {
  137. const data = stringToJson(res.bizContent);
  138. for (var i = 0; i < data.data.length; i++) {
  139. data.data[i]['isShow'] = false;
  140. }
  141. state.list = data.data
  142. console.log("222", data.data)
  143. })
  144. }
  145. const change = (e) => {
  146. console.log(e);
  147. }
  148. //获取微信小程序openid
  149. const getOpenID = () => {
  150. // #ifdef MP-WEIXIN
  151. uni.login({
  152. provider: "weixin",
  153. success: function (e) {
  154. console.log(e);
  155. getOpenid(e.code);
  156. },
  157. });
  158. //#endif
  159. };
  160. const getOpenid = (code) => {
  161. const options = {
  162. type: 2,
  163. data: {
  164. "jsCode": code
  165. },
  166. method: "POST",
  167. showLoading: true,
  168. };
  169. // #ifdef MP-WEIXIN
  170. request(getOpenidApi, options).then((res) => {
  171. const result = stringToJson(res.bizContent);
  172. console.log("获取微信小程序openid", result);
  173. const openidData = stringToJson(result.data);
  174. state.openid = openidData.openid;
  175. setItem("QYorder", state);
  176. });
  177. // #endif
  178. }
  179. const changeIsShow = (index) => {
  180. console.log(index, state.list[index]['isShow'], !state.list[index]['isShow'])
  181. state.list[index]['isShow'] = !state.list[index]['isShow']
  182. console.log("state.list", state.list)
  183. }
  184. const getValue = (value) => {
  185. if (state.choiceValue.length == 0) {
  186. console.log("第一次")
  187. state.choiceValue.push(value)
  188. console.log("state.choiceValue", state.choiceValue)
  189. } else {
  190. var index = state.choiceValue.indexOf(value);
  191. if (index > -1) {//大于0 代表存在,
  192. state.choiceValue.splice(index, 1);//存在就删除
  193. } else {
  194. state.choiceValue.push(value)
  195. }
  196. console.log("state.choiceValue", state.choiceValue)
  197. }
  198. }
  199. </script>
  200. <style scoped lang="scss">
  201. .imageDefault {
  202. height: 40rpx;
  203. width: 40rpx;
  204. transform: rotate(270deg);
  205. margin-right: 12rpx;
  206. color: white;
  207. }
  208. .imageChange {
  209. height: 40rpx;
  210. width: 40rpx;
  211. transform: rotate(90deg);
  212. margin-right: 12rpx;
  213. color: white;
  214. }
  215. .item {
  216. width: 90%;
  217. margin: 20rpx auto;
  218. background-color: rgb(41, 199, 207);
  219. border-radius: 20rpx;
  220. padding: 20rpx;
  221. box-sizing: border-box;
  222. color: white;
  223. font-size: 32rpx;
  224. }
  225. .button {
  226. height: 80rpx;
  227. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  228. border-radius: 40rpx;
  229. font-size: 32rpx;
  230. font-weight: 400;
  231. color: #ffffff;
  232. line-height: 80rpx;
  233. }
  234. .item>.title {
  235. width: 100%;
  236. display: flex;
  237. justify-content: space-between;
  238. align-items: center;
  239. }
  240. .children {
  241. margin-left: 50rpx;
  242. margin-top: 16rpx;
  243. }
  244. .children>view {
  245. height: 50rpx;
  246. line-height: 50rpx;
  247. }
  248. .show {
  249. display: inline-block;
  250. }
  251. .hide {
  252. display: none;
  253. }
  254. .ul-item {
  255. // padding: 5px 20rpx;
  256. padding-top: 20rpx;
  257. display: flex;
  258. align-items: center;
  259. .item-value {
  260. padding: 20rpx;
  261. position: absolute;
  262. display: flex;
  263. align-items: center;
  264. width: 80%;
  265. .content {
  266. width: 51%;
  267. .title {
  268. font-size: 32rpx;
  269. font-family: Microsoft YaHei;
  270. font-weight: 400;
  271. color: #ffffff;
  272. }
  273. .tip {
  274. font-size: 24rpx;
  275. font-family: Microsoft YaHei;
  276. font-weight: 400;
  277. color: #ffffff;
  278. }
  279. }
  280. }
  281. .icon-tip {
  282. width: 100rpx;
  283. height: 100rpx;
  284. }
  285. .content {
  286. margin-left: 40rpx;
  287. }
  288. }
  289. .money {
  290. color: white;
  291. }
  292. </style>