integrals.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  1. <template>
  2. <view :class="[AppTheme]" class="wrap" v-if="addressData && orderList">
  3. <navigator url="/pagesD/pages/address/address?source=1" class="address-section">
  4. <view class="order-content border-primary" v-if="addressData">
  5. <u-icon name="map-fill" color="#2979ff" size="25"></u-icon>
  6. <view class="cen">
  7. <view class="top">
  8. <text class="name">{{ addressData.name }}</text>
  9. <text class="mobile">{{ addressData.mobile }}</text>
  10. </view>
  11. <text class="address">{{ addressData.address }} {{ addressData.area || '' }}</text>
  12. </view>
  13. <text class="yticon icon-you"></text>
  14. </view>
  15. <view class="isAddress border-primary" v-if="!addressData">去添加收货地址</view>
  16. </navigator>
  17. <view class="shopinfo">
  18. <view class="g-item">
  19. <image :src=" orderList.pic"></image>
  20. <view class="right">
  21. <text class="title clamp">{{ orderList.name }}</text>
  22. <text class="spec">单位{{ orderList.unit }}</text>
  23. <view class="price-box">
  24. <text class="price text-neutral">{{ orderList.integral }}</text>
  25. <!-- 有疑问-->
  26. <text class="number">X 1</text>
  27. </view>
  28. </view>
  29. </view>
  30. <view class="g-text"><textarea value="" placeholder="给我们留言" v-model="areaVal"></textarea></view>
  31. </view>
  32. <!-- 底部 -->
  33. <view class="footer">
  34. <view class="price-content">
  35. <text>消耗积分</text>
  36. <!-- <text class="price-tip">¥</text> -->
  37. <text class="price text-neutral">{{ orderList.integral }}</text>
  38. </view>
  39. <text class="submit bg-linear-gradient" @click="submit">确认兑换</text>
  40. </view>
  41. </view>
  42. </template>
  43. <script>
  44. import api from '@/api/mall/index.js';
  45. import api_address from '@/api/address/address.js';
  46. export default {
  47. data() {
  48. return {
  49. primary: this.$theme.primary,
  50. addressData: '',
  51. orderList: '',
  52. settingFile: getApp().globalData.siteinfo,
  53. areaVal: '',
  54. sho_id: '',
  55. kg: true,
  56. address_id: '',
  57. items: ''
  58. };
  59. },
  60. onLoad(options) {
  61. this.getAddressData(options); //请求收货地址
  62. this.sho_id = options.id;
  63. },
  64. methods: {
  65. getAddressData(option) {
  66. api_address.address().then(res => {
  67. if (res.status == 200) {
  68. let is_default = res.data.data.filter(item => item.is_default == 1);
  69. this.addressData = is_default[0];
  70. console.log('哈哈大厦的' + this.addressData);
  71. this.orderIndex(option);
  72. } else {
  73. this.$api.msg(res.msg);
  74. }
  75. });
  76. },
  77. /* 获取订单信息*/
  78. orderIndex(option) {
  79. const data = {
  80. id: option.id,
  81. vipadd: this.addressData.vipid
  82. };
  83. api.orderIndex(data).then(res => {
  84. if (res.status == 200) {
  85. this.orderList = res.data.cache;
  86. this.items = res.data.allitems;
  87. } else {
  88. this.$api.msg(res.msg);
  89. }
  90. });
  91. },
  92. submit() {
  93. if (!this.addressData) {
  94. this.$api.msg('请选择收货地址!');
  95. return;
  96. }
  97. if (this.kg) {
  98. this.kg = false;
  99. // var obj = {
  100. // sid: 0,
  101. // paytype,
  102. // vipid: this.orderList.vipid,
  103. // vipopenid: userInfo.openid,
  104. // vipname: this.orderList.vip.name,
  105. // vipaddress: this.orderList.vip.address,
  106. // vipmobile: this.orderList.vip.mobile,
  107. // totalnum: this.orderList.totalnum,
  108. // totalprice: this.orderList.totalprice,
  109. // djqid: 0,
  110. // isact: '',
  111. // groupid: this.$store.state.groupid,
  112. // delivery,
  113. // address: this.orderList.vip.id,
  114. // sinceid: 0,
  115. // bid: this.orderList.bid,
  116. // items: this.orderList.allitems,
  117. // province: this.city[0].s,
  118. // city: this.city[1].b,
  119. // district: this.city[2].m,
  120. // msg: this.desc,
  121. // };
  122. console.log(this.items);
  123. api.orderMake({
  124. goodstype: this.orderList.type,
  125. items: encodeURI(this.items),
  126. address_id: this.addressData.id,
  127. id: this.sho_id,
  128. msg: encodeURI(this.areaVal)
  129. }).then(ret => {
  130. this.$u.toast(ret.msg);
  131. uni.showToast({
  132. icon: 'none',
  133. title: ret.msg,
  134. duration: 1500
  135. });
  136. if (ret.status == 200) {
  137. setTimeout(() => {
  138. uni.redirectTo({
  139. url: '/pagesE/pages/mall/integral'
  140. });
  141. this.kg = true;
  142. }, 1000);
  143. } else {
  144. setTimeout(() => {
  145. this.kg = true;
  146. this.$u.toast(ret.msg);
  147. }, 2000)
  148. }
  149. });
  150. }
  151. }
  152. }
  153. };
  154. </script>
  155. <style lang="scss">
  156. page {
  157. width: 100%;
  158. height: 100%;
  159. }
  160. .wrap {
  161. width: 100%;
  162. height: 100%;
  163. background-color: #ffffff;
  164. }
  165. .address-section {
  166. padding: 10upx 0 20upx 0;
  167. background: #fff;
  168. position: relative;
  169. .order-content {
  170. display: flex;
  171. align-items: center;
  172. border-bottom-width: 6upx;
  173. border-bottom-style: solid;
  174. padding-bottom: 20upx;
  175. }
  176. .isAddress {
  177. display: flex;
  178. align-items: center;
  179. justify-content: center;
  180. height: 140upx;
  181. border-bottom-width: 6upx;
  182. border-bottom-style: solid;
  183. }
  184. .icon-shouhuodizhi {
  185. flex-shrink: 0;
  186. display: flex;
  187. align-items: center;
  188. justify-content: center;
  189. width: 90upx;
  190. color: #888;
  191. font-size: 30rpx;
  192. }
  193. .cen {
  194. margin-left: 10rpx;
  195. display: flex;
  196. flex-direction: column;
  197. flex: 1;
  198. font-size: 28rpx;
  199. color: $font-color-dark;
  200. }
  201. .name {
  202. font-size: 28rpx;
  203. margin-right: 24upx;
  204. }
  205. .address {
  206. font-size: 24rpx;
  207. margin-top: 16upx;
  208. margin-right: 20upx;
  209. color: $font-color-light;
  210. }
  211. .icon-you {
  212. font-size: 32upx;
  213. color: $font-color-light;
  214. margin-right: 30upx;
  215. }
  216. .a-bg {
  217. position: absolute;
  218. left: 0;
  219. bottom: 0;
  220. display: block;
  221. width: 100%;
  222. height: 5upx;
  223. }
  224. }
  225. .shopinfo {
  226. min-height: 220upx;
  227. background: #fff;
  228. }
  229. .g-text {
  230. width: 92.5%;
  231. height: 195rpx;
  232. padding: 30rpx;
  233. border: 1px solid #f1f1f1;
  234. margin: 10px auto;
  235. textarea {
  236. width: 100%;
  237. font-size: 28upx;
  238. }
  239. }
  240. .footer {
  241. position: fixed;
  242. left: 0;
  243. bottom: 0;
  244. z-index: 995;
  245. display: flex;
  246. align-items: center;
  247. width: 100%;
  248. height: 90upx;
  249. justify-content: space-between;
  250. font-size: 30upx;
  251. background-color: #fff;
  252. z-index: 998;
  253. color: $font-color-base;
  254. box-shadow: 0 -1px 5px rgba(0, 0, 0, 0.1);
  255. .price-content {
  256. padding-left: 30upx;
  257. }
  258. .price-tip {
  259. color: $base-color;
  260. margin-left: 8upx;
  261. }
  262. .price {
  263. font-size: 36upx;
  264. }
  265. .submit {
  266. display: flex;
  267. align-items: center;
  268. justify-content: center;
  269. width: 280upx;
  270. height: 100%;
  271. color: #fff;
  272. font-size: 32upx;
  273. }
  274. }
  275. .g-item {
  276. display: flex;
  277. margin: 0 30upx;
  278. // background: pink;
  279. image {
  280. flex-shrink: 0;
  281. display: block;
  282. width: 140upx;
  283. height: 140upx;
  284. border-radius: 4upx;
  285. }
  286. .right {
  287. flex: 1;
  288. padding-left: 24upx;
  289. overflow: hidden;
  290. }
  291. .title {
  292. font-size: 30upx;
  293. color: $font-color-dark;
  294. margin-bottom: 21rpx;
  295. }
  296. .spec {
  297. font-size: 26upx;
  298. color: $font-color-light;
  299. }
  300. .price-box {
  301. display: flex;
  302. align-items: center;
  303. font-size: 32upx;
  304. color: $font-color-dark;
  305. padding-top: 23upx;
  306. .price {
  307. margin-bottom: 4upx;
  308. }
  309. .number {
  310. font-size: 26upx;
  311. color: $font-color-base;
  312. margin-left: 20upx;
  313. }
  314. }
  315. .step-box {
  316. position: relative;
  317. }
  318. }
  319. </style>