userShopDetails.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449
  1. <template>
  2. <view class="user-shop-details">
  3. <u-toast ref="uToast" />
  4. <view style="background-color: $color-white !important;">
  5. <u-navbar :back-text="i18n('Back')" :back-text-style="backStyle" back-icon-color="#fff" title-color="#fff"
  6. :background="background" title-width="300" :title="i18n('userShopDetails')"></u-navbar>
  7. </view>
  8. <view class="content">
  9. <view class="content-title">
  10. <image :src="websiteUrl + shopInfo.picture" class="left-pic"></image>
  11. </view>
  12. </view>
  13. <view class="shop-info">
  14. <view class="shop-title">
  15. <text>{{$i18n.locale=='zh'?shopInfo.commodityName:shopInfo.commodityNameEn}}</text>
  16. <text v-if="shopInfo.commodityStatus==2"
  17. style="margin-left: 1px; display: inline-block;text-align: center;width:65px;height:20px;line-height:20px; background-color:#f0f9eb;border:1px solid #eaf7e4;color:#5ec142;border-radius: 10px;font-size: 14rpx; ">
  18. {{ $i18n.locale == "zh" ? "已结束" : "Ended" }}
  19. </text>
  20. </view>
  21. <view class="shop-price">{{shopInfo.point}}{{$i18n.locale=='zh'?'积分':'integral'}}</view>
  22. <view class="shop-detail">
  23. <view class="shop-num">
  24. <view class="shop-get">{{$i18n.locale=='zh'?'已兑换':'Has change'}}:{{shopInfo.exchangeQuantity}}
  25. </view>
  26. <view class="shop-to">{{$i18n.locale=='zh'?'剩余':'Residue'}}:{{shopInfo.usageQuantity}}</view>
  27. </view>
  28. <view class="shop-time" v-if="$i18n.locale=='zh'">
  29. 有效期至:{{shopInfo.expirationType=='y'?'长期有效':`${moment(shopInfo.createDate).format('YYYY-MM-DD')}`}}
  30. </view>
  31. <view class="shop-time" v-if="$i18n.locale!='zh'">
  32. Valid
  33. until:{{shopInfo.expirationType=='y'?'Long effective':`${moment(shopInfo.createDate).format('YYYY-MM-DD')}`}}
  34. </view>
  35. </view>
  36. <view class="shop-need">
  37. <view class="shop-many">{{$i18n.locale=='zh'?'数量':'Quantity'}}</view>
  38. <view class="shop-btn">
  39. <view class="btn-little" @tap="downNum()">-</view>
  40. <view class="shop-munch btn-little" id="addtext">{{addtext}}</view>
  41. <view class="btn-little" @tap="addNum(shopInfo.usageQuantity)">+</view>
  42. </view>
  43. <view class="user-btn-ui" v-if="shopInfo.commodityStatus==2">
  44. <!-- <button class="user-defeat" @tap="tochangeAddress(shopInfo.id,shopInfo.exchangeObject)"
  45. v-if="shopInfo.usageQuantity>=1" disabled="true">
  46. {{$i18n.locale=='zh'?'确认兑换':'Confirm the change'}}
  47. </button>
  48. <button class="user-defeat" v-else>{{$i18n.locale=='zh'?'暂无存货':'No inventory'}}</button> -->
  49. </view>
  50. <view class="user-btn-ui" v-else>
  51. <button class="user-success" @tap="tochangeAddress(shopInfo.id,shopInfo.exchangeObject)"
  52. v-if="shopInfo.usageQuantity>=1">
  53. {{$i18n.locale=='zh'?'确认兑换':'Confirm the change'}}
  54. </button>
  55. <button class="user-defeat" v-else>{{$i18n.locale=='zh'?'暂无存货':'No inventory'}}</button>
  56. </view>
  57. </view>
  58. </view>
  59. <view class="user-info">
  60. <view class="user-title">{{$i18n.locale=='zh'?'规则信息':'Rules of the information'}}</view>
  61. <view class="user-what">
  62. <view class="user-who">{{$i18n.locale=='zh'?'兑换对象':'For object'}}:</view>
  63. <view class="user-right" v-if="$i18n.locale=='zh'">
  64. {{shopInfo.exchangeObject}}
  65. </view>
  66. <view class="user-right" v-if="$i18n.locale!='zh'">
  67. {{shopInfo.exchangeObject}}
  68. </view>
  69. </view>
  70. <view class="user-what">
  71. <view class="user-who">{{$i18n.locale=='zh'?'兑换限制':'Exchange restrictions'}}:</view>
  72. <view class="user-right" v-if="$i18n.locale=='zh'">
  73. {{shopInfo.restrict=='y'?shopInfo.exchangeRestrict:'无限制'}}
  74. </view>
  75. <view class="user-right" v-if="$i18n.locale!='zh'">
  76. {{shopInfo.restrict=='y'?shopInfo.exchangeRestrict:'Unrestricted'}}
  77. </view>
  78. </view>
  79. <view class="user-what">
  80. <view class="user-who">{{$i18n.locale=='zh'?'活动有效期':'Validity of activity'}}:</view>
  81. <view class="user-right" v-if="$i18n.locale=='zh'">
  82. {{shopInfo.expirationType=='y'?'长期有效':`${moment(shopInfo.createDate).format('YYYY-MM-DD')}`}}
  83. </view>
  84. <view class="user-right" v-if="$i18n.locale!='zh'">
  85. {{shopInfo.expirationType=='y'?'Long-term effective':`${moment(shopInfo.createDate).format('YYYY-MM-DD')}`}}
  86. </view>
  87. </view>
  88. <!-- <view class="user-what">
  89. <view class="user-who">{{$i18n.locale=='zh'?'活动限制':'Activity restrictions'}}:</view>
  90. <view class="user-right">{{$i18n.locale=='zh'?'活动有效期':'Validity of activity'}}</view>
  91. </view> -->
  92. </view>
  93. <view class="user-detail">
  94. <view class="user-shop-title">{{$i18n.locale=='zh'?'礼品介绍':'Products introduction'}}:</view>
  95. <view class="user-shop-pic">
  96. <image :src="websiteUrl + shopInfo.picture" class="left-pic"></image>
  97. </view>
  98. <view class="user-text">{{$i18n.locale=='zh'?shopInfo.commodityDetails:shopInfo.commodityDetailsEn}}</view>
  99. </view>
  100. <view class="table-null"></view>
  101. <view>
  102. <!-- 提示信息弹窗 -->
  103. <uni-popup ref="message">
  104. <uni-popup-message :type="msgType" :message="messageText" :duration="2000"></uni-popup-message>
  105. </uni-popup>
  106. </view>
  107. </view>
  108. </template>
  109. <script>
  110. import uniPopupDialog from '@/components/uni-popup/uni-popup-dialog.vue'
  111. import uniPopupMessage from '@/components/uni-popup/uni-popup-message.vue'
  112. import uniPopup from '@/components/uni-popup/uni-popup.vue'
  113. import moment from "moment"
  114. export default {
  115. components: {
  116. moment,
  117. uniPopupDialog,
  118. uniPopupMessage,
  119. uniPopup
  120. },
  121. data() {
  122. return {
  123. background: {
  124. backgroundImage: 'linear-gradient(270deg, #4BC0E2 0%, #538BE7 100%)',
  125. },
  126. backStyle: {
  127. color: '#FFFFFF',
  128. },
  129. shopInfo: {},
  130. grade: null,
  131. id: null,
  132. msgType: 'success',
  133. messageText: '这是一条成功提示',
  134. addtext: 1
  135. }
  136. },
  137. onLoad(id) {
  138. // console.log(id);
  139. this.grade = id.grade;
  140. this.id = id.id;
  141. this.getShopDetail()
  142. },
  143. filters: {
  144. twoDecimal(value) {
  145. return parseFloat(string(value)).toFixed(2);
  146. },
  147. time(data, type) {
  148. return moment(data).format(type);
  149. }
  150. },
  151. methods: {
  152. i18n(data) {
  153. return this.$t('common.' + data);
  154. },
  155. change(e) {
  156. console.log('当前模式:' + e.type + ',状态:' + e.show);
  157. },
  158. addNum(e) {
  159. // var num = document.getElementById('addtext');
  160. // if (num.innerHTML <= e - 1) {
  161. // num.innerHTML++;
  162. // }
  163. //document.cookie=num.value;
  164. if (this.addtext <= e - 1) {
  165. this.addtext = this.addtext + 1;
  166. }
  167. },
  168. downNum() {
  169. // var num = document.getElementById('addtext');
  170. // if (num.innerHTML >= 2) {
  171. // num.innerHTML--;
  172. // }
  173. if (this.addtext > 1) {
  174. this.addtext = this.addtext - 1;
  175. }
  176. },
  177. tochangeAddress(id, userGrade) {
  178. console.log(id, '--------->');
  179. // var num = document.getElementById('addtext');
  180. var num = this.addtext;
  181. // num = num.innerHTML
  182. console.log(userGrade, '==========');
  183. // console.log(num);
  184. if (userGrade == 'V3,V2,V1') {
  185. uni.navigateTo({
  186. url: './changeAddress?id=' + id + '&num=' + num,
  187. })
  188. } else if (userGrade == this.grade) {
  189. uni.navigateTo({
  190. url: './changeAddress?id=' + id + '&num=' + num,
  191. })
  192. } else {
  193. // this.msgType = type
  194. this.messageText = `当前用户等级不符合该礼品兑换需求`
  195. this.$refs.message.open()
  196. }
  197. },
  198. //获取礼品详情
  199. async getShopDetail() {
  200. // console.log(id, '-----------');
  201. const res = await this.$myRequest({
  202. url: '/uc/umsPointCommoditys',
  203. data: {
  204. id: this.id
  205. },
  206. })
  207. // console.log(res, '============');
  208. this.shopInfo = res.data.umsPointCommoditys[0]
  209. // console.log(this.shopInfo, '====================');
  210. }
  211. }
  212. }
  213. </script>
  214. <style lang="scss" scoped>
  215. .user-shop-details {
  216. background-color: #cacacaf;
  217. .content {
  218. width: 96%;
  219. height: 500rpx;
  220. margin-left: 2%;
  221. background-color: #dadee1ff;
  222. .content-title {
  223. width: 100%;
  224. height: 100%;
  225. .left-pic {
  226. width: 90%;
  227. margin-left: 5%;
  228. height: 400rpx;
  229. margin-top: 50rpx;
  230. }
  231. }
  232. }
  233. .shop-info {
  234. width: 96%;
  235. height: 240rpx;
  236. margin-left: 2%;
  237. background-color: #fff;
  238. margin-top: 20rpx;
  239. .shop-title {
  240. width: 100%;
  241. height: 60rpx;
  242. line-height: 60rpx;
  243. font-size: 32rpx;
  244. text-align: center;
  245. font-weight: 700;
  246. }
  247. .shop-price {
  248. font-size: 30rpx;
  249. font-weight: 700;
  250. color: red;
  251. width: 92%;
  252. height: 50rpx;
  253. line-height: 50rpx;
  254. margin-left: 4%;
  255. }
  256. .shop-detail {
  257. width: 92%;
  258. margin-left: 4%;
  259. height: 50rpx;
  260. display: flex;
  261. justify-content: space-between;
  262. .shop-num {
  263. width: 55%;
  264. height: 50rpx;
  265. display: flex;
  266. .shop-get {
  267. width: 55%;
  268. height: 50rpx;
  269. line-height: 50rpx;
  270. font-size: 24rpx;
  271. margin-right: 10rpx;
  272. }
  273. .shop-to {
  274. width: 45%;
  275. height: 50rpx;
  276. line-height: 50rpx;
  277. font-size: 24rpx;
  278. }
  279. }
  280. .shop-time {
  281. width: 45%;
  282. height: 50rpx;
  283. line-height: 50rpx;
  284. font-size: 24rpx;
  285. }
  286. }
  287. .shop-need {
  288. width: 92%;
  289. margin-left: 4%;
  290. display: flex;
  291. .shop-many {
  292. height: 80rpx;
  293. line-height: 80rpx;
  294. margin-right: 20rpx;
  295. }
  296. .shop-btn {
  297. display: flex;
  298. height: 80rpx;
  299. .btn-little {
  300. margin-top: 20rpx;
  301. text-align: center;
  302. width: 40rpx;
  303. height: 40rpx;
  304. line-height: 40rpx;
  305. border: 1rpx solid #b0b0b0;
  306. color: black;
  307. }
  308. .shop-munch {
  309. border-left: none;
  310. border-right: none;
  311. }
  312. }
  313. .user-btn-ui {
  314. height: 50rpx;
  315. margin-top: 10rpx;
  316. margin-left: 43%;
  317. border-radius: 50rpx;
  318. .user-success {
  319. width: 100%;
  320. height: 50rpx;
  321. line-height: 50rpx;
  322. text-align: center;
  323. background-color: #0000ff;
  324. border-radius: 50rpx;
  325. color: white;
  326. font-size: 26rpx;
  327. }
  328. .user-defeat {
  329. height: 50rpx;
  330. line-height: 50rpx;
  331. text-align: center;
  332. background-color: #989898;
  333. border-radius: 50rpx;
  334. color: white;
  335. font-size: 26rpx;
  336. }
  337. }
  338. }
  339. }
  340. .user-info {
  341. height: 300rpx;
  342. width: 96%;
  343. margin-left: 2%;
  344. background-color: #fff;
  345. margin-top: 20rpx;
  346. .user-title {
  347. width: 92%;
  348. margin-left: 4%;
  349. font-weight: 700;
  350. height: 80rpx;
  351. line-height: 80rpx;
  352. }
  353. .user-what {
  354. width: 92%;
  355. margin-left: 4%;
  356. display: flex;
  357. .user-who {
  358. width: 45%;
  359. font-size: 24rpx;
  360. color: #bcbcbe;
  361. height: 50rpx;
  362. line-height: 50rpx;
  363. text-align: right;
  364. transform: translateX(-10%);
  365. }
  366. .user-right {
  367. height: 50rpx;
  368. line-height: 50rpx;
  369. color: black;
  370. font-size: 26rpx;
  371. }
  372. }
  373. }
  374. .user-detail {
  375. width: 96%;
  376. margin-left: 2%;
  377. margin-top: 20rpx;
  378. background-color: #fff;
  379. .user-shop-title {
  380. width: 92%;
  381. margin-left: 4%;
  382. height: 80rpx;
  383. line-height: 80rpx;
  384. font-weight: 700;
  385. }
  386. .user-shop-pic {
  387. width: 100%;
  388. height: 500rpx;
  389. text-align: center;
  390. .left-pic {
  391. width: 90%;
  392. height: 400rpx;
  393. margin-top: 50rpx;
  394. }
  395. }
  396. .user-text {
  397. width: 92%;
  398. margin-left: 4%;
  399. overflow: hidden;
  400. }
  401. }
  402. .table-null {
  403. height: 30rpx;
  404. }
  405. }
  406. </style>