integralOrder.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558
  1. <template>
  2. <view class="exchangePrize">
  3. <!-- 表单 -->
  4. <view class="form">
  5. <view class="">
  6. <uni-forms :modelValue="formData">
  7. <uni-forms-item name="type" v-if="istype">
  8. <view class="selectType" @click="openSelect">
  9. <view class="uni-input">
  10. <text v-if="formData.type==''||formData.type==null"
  11. style="color: #999999 ;font-size: 30rpx;">请选择配送方式</text>
  12. <text v-if="formData.type!=''" style="font-size: 30rpx;">{{formData.type}}</text>
  13. </view>
  14. <image src="/static/icon/right.png"
  15. style="width: 14rpx;height: 24rpx;position: absolute;top:31rpx;right: 30rpx;">
  16. </image>
  17. </view>
  18. </uni-forms-item>
  19. <uni-forms-item name="name" v-if="formData.type!=''||isVerification==true">
  20. <uni-easyinput type="text" v-model="Data.receiver" placeholder="填写联系人" />
  21. </uni-forms-item>
  22. <uni-forms-item name="phone" v-if="formData.type!=''||isVerification==true">
  23. <uni-easyinput type="number" v-model="Data.phone" placeholder="填写联系电话" maxlength=11 />
  24. </uni-forms-item>
  25. <uni-forms-item name="region" v-if="formData.type=='快递配送'">
  26. <pickerAddress @change="change">
  27. <!-- <uni-easyinput type="text" v-model="formData.region" placeholder="所在地区" /> -->
  28. <view class="selectType">
  29. <view class="uni-input">
  30. <text v-if="formData.region==''||formData.region==null"
  31. style="color: #999999 ; font-size: 30rpx; ">所在地区</text>
  32. <text style="font-size: 30rpx;" v-if="formData.region!=''">{{formData.region}}</text>
  33. </view>
  34. <image src="/static/icon/right.png"
  35. style="width: 14rpx;height: 24rpx;position: absolute;top:31rpx;right: 30rpx;">
  36. </image>
  37. </view>
  38. </pickerAddress>
  39. </uni-forms-item>
  40. <uni-forms-item name="region" v-if="formData.type=='快递配送'">
  41. <textarea placeholder-style="#999" class="text-area" type="text" placeholder="详细地址" v-model="Data.address" />
  42. </uni-forms-item>
  43. <uni-forms-item name="region" v-if="formData.type=='到店自提'||isVerification==true">
  44. <view class="selectType" @click="openShop">
  45. <view class="uni-input">
  46. <text v-if="formData.shop==''||formData.shop==null"
  47. style="color: #999999 ; font-size: 30rpx; ">请选择门店</text>
  48. <text style="font-size: 30rpx;" v-if="formData.shop!=''">{{formData.shop}}</text>
  49. </view>
  50. <image src="/static/icon/right.png"
  51. style="width: 14rpx;height: 24rpx;position: absolute;top:31rpx;right: 30rpx;">
  52. </image>
  53. </view>
  54. </uni-forms-item>
  55. </uni-forms>
  56. </view>
  57. </view>
  58. <!-- 产品信息 -->
  59. <view class="msg">
  60. <view class="title">
  61. <text>产品信息</text>
  62. </view>
  63. <view class="shopCard">
  64. <image :src="productDetail.cover_img?productDetail.cover_img:'http://t9.9026.com/imgs/Kudosbg.png'"></image>
  65. <view style="margin-left: 24rpx;">
  66. <text class="name">{{productDetail.name}}</text>
  67. <text class="tag">礼盒装 </text>
  68. </view>
  69. </view>
  70. <view class="shopNumber">
  71. <text>件数</text>
  72. <text>1件</text>
  73. </view>
  74. <view class="shopNumber">
  75. <text>积分</text>
  76. <text>{{productDetail.integral}}积分</text>
  77. </view>
  78. <view style="width: 694rpx;height: 4rpx;border: 2rpx solid #F2F2F2;margin-top: 38rpx;"></view>
  79. <view class="shopNumber">
  80. <text>合计</text>
  81. <text>{{productDetail.integral}}积分</text>
  82. </view>
  83. </view>
  84. <!-- 兑换按钮 -->
  85. <view class="bottombtn" @click="goExchange">
  86. <view class="btnitem">
  87. <text>确认兑换</text>
  88. </view>
  89. </view>
  90. <!-- 配送方式-->
  91. <uni-popup ref="Recipient" type="bottom" mask-background-color=" rgba(0,0,0,0.7);">
  92. <view class="pop">
  93. <view class="popuptitle">
  94. <view @click="cancelBtn" style="width: 68rpx;color: #999;font-size: 32rpx;">
  95. <text>取消</text>
  96. </view>
  97. <view>
  98. <text style="font-weight: bold; font-size: 32rpx; color: #080F18; ">配送方式</text>
  99. </view>
  100. <view @click="sureBtn" style="width: 68rpx;"><text
  101. style="font-size: 32rpx; color: #FF6200;line-height: 34rpx">确定</text></view>
  102. </view>
  103. <view class="chooselag">
  104. <view @click="companyed(item.name,index)" class="language" v-for="(item,index) in typeSelect "
  105. :sgActive='activeIndex==index'>
  106. <text>{{item.name}}</text>
  107. </view>
  108. </view>
  109. </view>
  110. </uni-popup>
  111. <!-- 门店选择-->
  112. <uni-popup ref="shopSelected" type="bottom" mask-background-color=" rgba(0,0,0,0.7);">
  113. <view class="pop">
  114. <view class="popuptitle">
  115. <view @click="cancelShopBtn" style="width: 68rpx;color: #999;font-size: 32rpx;">
  116. <text>取消</text>
  117. </view>
  118. <view>
  119. <text style="font-weight: bold; font-size: 32rpx; color: #080F18; ">配送方式</text>
  120. </view>
  121. <view @click="sureShopBtn" style="width: 68rpx;"><text
  122. style="font-size: 32rpx; color: #FF6200;line-height: 34rpx">确定</text></view>
  123. </view>
  124. <view class="chooselag">
  125. <view @click="companyedShop(item.name,index)" class="language" v-for="(item,index) in regionSelect "
  126. :sgActive='activeIndex==index'>
  127. <text>{{item.name}}</text>
  128. </view>
  129. </view>
  130. </view>
  131. </uni-popup>
  132. </view>
  133. </template>
  134. <script>
  135. import pickerAddress from '@/uni_modules/hu-pickerAddress/hu-pickerAddress.vue'
  136. export default {
  137. components: {
  138. pickerAddress
  139. },
  140. data() {
  141. return {
  142. activeIndex: null,
  143. // 是否核销
  144. isVerification: false,
  145. // 产品信息
  146. productDetail:'',
  147. // 表单数据
  148. formData: {
  149. type: '',
  150. phone: '',
  151. name: '',
  152. region: '',
  153. shop: '',
  154. address: '',
  155. },
  156. Data:{
  157. // 快递类型(1.快递发货 2.到店自提也是线下核销)
  158. express_type:'',
  159. // 收货人
  160. receiver:"",
  161. // 联系电话
  162. phone:'',
  163. // 地址ID,最小行政单位地区ID,express_type=1时必传
  164. area_id:2000,
  165. // 详细地址,express_type=1时必传
  166. address:'',
  167. // 门店ID,express_type=2时必传
  168. hotel_id:'',
  169. // 产品ID
  170. product_id:'',
  171. // 产品规格ID
  172. product_attr_id:1,
  173. },
  174. // 配送方式
  175. typeSelect: [{
  176. name: '快递配送',
  177. }, {
  178. name: '到店自提',
  179. }],
  180. // 是否显示配送方式
  181. istype: true,
  182. // 选择门店
  183. regionSelect: [{
  184. name: '第一门店',
  185. }, {
  186. name: '第二门店',
  187. }, {
  188. name: '第三门店',
  189. }, {
  190. name: '第四门店',
  191. }, {
  192. name: '第五门店',
  193. }, {
  194. name: '第六门店',
  195. }, {
  196. name: '第七门店',
  197. }]
  198. }
  199. },
  200. onLoad(op) {
  201. console.log(op,"产品id")
  202. this.Data.product_id=op.product_id
  203. this.getProductDetail(op.product_id)
  204. },
  205. methods: {
  206. change(ret){
  207. this.formData.region = ret.data.join('-')
  208. },
  209. //打开门店弹框
  210. openShop() {
  211. this.$refs.shopSelected.open('bottom')
  212. },
  213. companyedShop(i, index) {
  214. this.typestatus2 = i
  215. this.activeIndex = index
  216. console.log(i, this.activeIndex)
  217. this.Data.hotel_id=index
  218. },
  219. //确定按钮
  220. sureShopBtn() {
  221. if (this.typestatus2 == undefined) {
  222. uni.showToast({
  223. icon: "none",
  224. title: '请选择门店'
  225. })
  226. } else {
  227. this.formData.shop = this.typestatus2
  228. this.$refs.shopSelected.close()
  229. }
  230. },
  231. //取消按钮
  232. cancelShopBtn() {
  233. this.$refs.shopSelected.close()
  234. },
  235. // 打开配送弹框
  236. openSelect() {
  237. this.$refs.Recipient.open('bottom')
  238. },
  239. //选择配送方式
  240. companyed(i, index) {
  241. this.typestatus1 = i
  242. this.activeIndex = index
  243. console.log(i, this.activeIndex)
  244. if(index==0){
  245. this.Data.express_type=1
  246. }else if(index==1){
  247. this.Data.express_type=2
  248. }
  249. },
  250. //确定按钮
  251. sureBtn() {
  252. if (this.typestatus1 == undefined) {
  253. uni.showToast({
  254. icon: "none",
  255. title: '请选择配送方式'
  256. })
  257. } else {
  258. this.formData.type = this.typestatus1
  259. this.$refs.Recipient.close()
  260. }
  261. },
  262. //取消按钮
  263. cancelBtn() {
  264. this.$refs.Recipient.close()
  265. },
  266. // 跳转积分兑换详情
  267. goExDetail(integral) {
  268. uni.navigateTo({
  269. url: '/pages/my/integral/integralExchange?integral='+integral
  270. })
  271. },
  272. // 积分兑换
  273. goExchange(){
  274. console.log(this.Data,"提交表单")
  275. this.$api.integral.integralExchange({
  276. ...this.Data
  277. }).then(res=>{
  278. console.log(res)
  279. if(res.code==0){
  280. this.goExDetail(this.productDetail.integral)
  281. }else{
  282. uni.showToast({
  283. title:res.msg,
  284. icon:'none'
  285. })
  286. }
  287. })
  288. },
  289. // 获取产品信息
  290. getProductDetail(id){
  291. this.$loading()
  292. this.$api.product.getProductDetail({
  293. product_id:id
  294. }).then(res=>{
  295. console.log(res,"产品信息")
  296. this.$hideLoading()
  297. if(res.code==0){
  298. this.productDetail=res.data
  299. }else{
  300. uni.showToast({
  301. title:res.msg,
  302. icon:'none'
  303. })
  304. }
  305. })
  306. },
  307. }
  308. }
  309. </script>
  310. <style lang="scss" scoped>
  311. $pageColor:#F9F9F9;
  312. $bgColor:#FFFFFF;
  313. @mixin flexlayout {
  314. display: flex;
  315. align-items: center;
  316. justify-content: center;
  317. }
  318. .exchangePrize {
  319. height: 100%;
  320. // background: #f9f9f9;
  321. }
  322. .uni-input-area{
  323. width: 100%;
  324. height: 98rpx;
  325. padding: 34rpx 20rpx;
  326. background: #FFFFFF;
  327. border-radius: 8rpx;
  328. border: 2rpx solid #EAEAEA;
  329. font-size: 30rpx;
  330. color: #000;
  331. line-height: 30rpx;
  332. }
  333. //底部弹框样式
  334. .pop {
  335. width: 100%;
  336. height: 616rpx;
  337. background: #FFFFFF;
  338. border-radius: 16rpx 16rpx 0 0;
  339. overflow: scroll;
  340. .popuptitle {
  341. position: fixed;
  342. top: 0;
  343. display: flex;
  344. width: 100%;
  345. padding: 0 30rpx;
  346. height: 122rpx;
  347. background: #fff;
  348. display: flex;
  349. align-items: center;
  350. justify-content: space-between;
  351. image {
  352. display: inline-block;
  353. width: 33rpx;
  354. height: 33rpx;
  355. border-radius: 1rpx;
  356. }
  357. }
  358. .chooselag {
  359. flex-direction: column;
  360. justify-content: center;
  361. align-items: center;
  362. background: #FFFFFF;
  363. padding: 0 30rpx;
  364. overflow-y: scroll;
  365. margin-top: 122rpx;
  366. .language {
  367. width: 100%;
  368. font-size: 32rpx;
  369. font-weight: 400;
  370. color: #777777;
  371. border-bottom: 1rpx #E2E4EA solid;
  372. display: flex;
  373. align-items: center;
  374. justify-content: center;
  375. padding-top: 40rpx;
  376. padding-bottom: 40rpx;
  377. &[sgActive] {
  378. color: #405E49 !important;
  379. font-weight: bold !important;
  380. }
  381. }
  382. }
  383. }
  384. .text-area {
  385. width: 100%;
  386. height: 130rpx;
  387. padding: 34rpx 20rpx;
  388. background: #FFFFFF;
  389. border-radius: 8rpx;
  390. border: 2rpx solid #EAEAEA;
  391. font-size: 30rpx;
  392. color: #000;
  393. line-height: 30rpx;
  394. }
  395. ::v-deep .uni-forms-item {
  396. // height: 98rpx;
  397. margin-bottom: 0;
  398. margin-top: 24rpx;
  399. font-size: 30rpx !important;
  400. &:first-child {
  401. margin-top: 0;
  402. }
  403. }
  404. ::v-deep .is-input-border {
  405. background-color: #ffffff !important;
  406. border: 2rpx solid #EAEAEA !important;
  407. height: 98rpx;
  408. }
  409. ::v-deep .uni-icons {
  410. color: #c0c4cc !important;
  411. }
  412. ::v-deep .uni-easyinput__placeholder-class {
  413. font-size: 30rpx !important;
  414. color: #999 !important;
  415. }
  416. ::v-deep .uni-easyinput__content-input {
  417. font-size: 30rpx !important;
  418. color: #000 !important;
  419. }
  420. .form {
  421. background: $pageColor;
  422. width: 750rpx;
  423. padding: 24rpx 30rpx;
  424. box-sizing: border-box;
  425. .selectType {
  426. width: 690rpx;
  427. height: 98rpx;
  428. background: #FFFFFF;
  429. border-radius: 8rpx;
  430. border: 2rpx solid #EAEAEA;
  431. display: flex;
  432. align-items: center;
  433. padding-left: 20rpx;
  434. box-sizing: border-box;
  435. position: relative;
  436. }
  437. }
  438. .msg {
  439. width: 750rpx;
  440. height: 700rpx;
  441. background: $bgColor;
  442. border-radius: 12rpx 12rpx 0px 0px;
  443. padding: 32rpx 30rpx;
  444. .title {
  445. margin-bottom: 24rpx;
  446. text {
  447. font-size: 32rpx;
  448. font-family: PingFang-SC-Bold, PingFang-SC;
  449. font-weight: bold;
  450. color: #080F18;
  451. }
  452. }
  453. .shopCard {
  454. margin-top: 28rpx;
  455. width: 694rpx;
  456. height: 164rpx;
  457. background: #F4F5F6;
  458. border-radius: 10rpx;
  459. display: flex;
  460. align-items: center;
  461. image {
  462. width: 132rpx;
  463. height: 132rpx;
  464. margin-left: 16rpx;
  465. display: inline-block;
  466. border-radius: 10rpx;
  467. }
  468. .name {
  469. font-size: 28rpx;
  470. font-family: PingFangSC-Medium, PingFang SC;
  471. font-weight: 500;
  472. color: #080F18;
  473. display: block;
  474. }
  475. .tag {
  476. font-size: 24rpx;
  477. font-family: PingFang-SC-Medium, PingFang-SC;
  478. font-weight: 500;
  479. color: #666666;
  480. }
  481. }
  482. .shopNumber {
  483. display: flex;
  484. justify-content: space-between;
  485. align-items: center;
  486. margin-top: 25rpx;
  487. text {
  488. font-size: 26rpx;
  489. font-family: PingFang-SC-Medium, PingFang-SC;
  490. font-weight: 500;
  491. color: #000000;
  492. }
  493. }
  494. }
  495. .bottombtn {
  496. width: 690rpx;
  497. height: 92rpx;
  498. background: linear-gradient(270deg, #FF6200 0%, #FF9342 100%);
  499. border-radius: 12rpx;
  500. margin-left: 30rpx;
  501. position: fixed;
  502. bottom: 72rpx;
  503. @include flexlayout() .btnitem {
  504. @include flexlayout() text {
  505. font-size: 30rpx;
  506. font-family: PingFang-SC-Bold, PingFang-SC;
  507. font-weight: bold;
  508. color: $bgColor;
  509. }
  510. }
  511. }
  512. </style>