checkOut.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. <template>
  2. <view class="page-content">
  3. <view class="content">
  4. <u-field
  5. class="field-item"
  6. :value="store.name"
  7. disabled
  8. input-align="right"
  9. label="收取门店"
  10. >
  11. </u-field>
  12. <u-field
  13. v-model="remarks"
  14. label="备注"
  15. input-align="right"
  16. auto-height
  17. :maxlength="10"
  18. placeholder="请填写备注(最多10个字符)"
  19. >
  20. </u-field>
  21. <view class="num-cont">
  22. <text class="u-required">支付数量</text>
  23. <view class="num-input">
  24. <u-input v-model="number" input-align="right" type="number" placeholder="请输入数量" />
  25. <u-image mode="scaleToFill" width="40rpx" height="40rpx" src="/static/ledou.png"></u-image>
  26. </view>
  27. </view>
  28. </view>
  29. <view class="pay-btn">
  30. <view class="total">
  31. <text>{{number||0}}</text>
  32. <u-image mode="scaleToFill" width="40rpx" height="40rpx" src="/static/ledou.png"></u-image>
  33. </view>
  34. <u-button @click="handlePay" type="success" >确认支付</u-button>
  35. </view>
  36. <!-- 确认支付弹窗 -->
  37. <u-popup mode="center" closeable @close="closeModal" v-model="showPayModal" width="600rpx" >
  38. <view class="slot-content">
  39. <view class="slot-title">请输入支付密码</view>
  40. <view class="text-cont">
  41. <view>
  42. <text>收取门店:</text>
  43. <text>{{store.name||'--'}}</text>
  44. </view>
  45. <view class="num-text">
  46. <text>支付数量:</text>
  47. <view>
  48. <text class="num-big">{{number}}</text>
  49. <u-image mode="scaleToFill" width="40rpx" height="40rpx" src="/static/ledou.png"></u-image>
  50. </view>
  51. </view>
  52. <view>
  53. <text>备&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注:</text>
  54. <text>{{remarks||'无'}}</text>
  55. </view>
  56. </view>
  57. <view class="footer">
  58. <input v-model="password"
  59. type="password"
  60. :focus="focus"
  61. placeholder="请输入支付密码"
  62. :maxlength="30"
  63. @confirm="confirm"
  64. />
  65. </view>
  66. <view class="fot-btn">
  67. <u-button @click="confirm" type="success" >确认支付</u-button>
  68. </view>
  69. </view>
  70. </u-popup>
  71. <!-- 提示用户设置支付密码 -->
  72. <u-modal v-model="showSetPswModal"
  73. content="请先设置支付密码,才能使用乐豆"
  74. show-cancel-button
  75. confirm-text="去设置"
  76. cancel-text="暂时放弃"
  77. @confirm="toSetPwd"
  78. @cancel="showSetPswModal=false"
  79. ></u-modal>
  80. </view>
  81. </template>
  82. <script>
  83. import { sellerReceive } from '@/api/user.js'
  84. import { existPayPwd } from '@/api/order.js'
  85. export default{
  86. data() {
  87. return {
  88. showSetPswModal: false,
  89. store: null, // 门店信息
  90. remarks: '', // 备注
  91. number: '', // 支付数量
  92. showPayModal: false, // 支付弹窗
  93. password: '', // 支付密码
  94. partnerNo: '', // 销售商编号
  95. currentGold: 0, //用户当前拥有乐豆数
  96. focus: false
  97. }
  98. },
  99. onLoad(opts) {
  100. this.currentGold = this.$store.state.vuex_userData.currentGold
  101. console.log(this.currentGold,'currentGold')
  102. console.log(opts)
  103. this.store = JSON.parse(decodeURIComponent(opts.store))
  104. },
  105. methods: {
  106. // 跳转到设置支付密码页
  107. toSetPwd () {
  108. uni.navigateTo({
  109. url:"/pages/userCenter/userInfo/smsVerification"
  110. })
  111. },
  112. // 确认支付
  113. handlePay() {
  114. if (!this.number) {
  115. uni.showToast({
  116. title: '请输入支付数量',
  117. icon: 'none'
  118. })
  119. } else {
  120. if (this.number>this.currentGold) {
  121. uni.showToast({
  122. title: '您当前余额不足!',
  123. icon: 'none'
  124. })
  125. return false
  126. }
  127. existPayPwd().then(res => {
  128. console.log(res,'rrrrrr')
  129. if(res.status == 200) {
  130. // 设置过支付密码,输入密码
  131. if(res.data) {
  132. this.showPayModal = true
  133. setTimeout(()=>{
  134. this.focus = true
  135. },300)
  136. } else {
  137. // 没设置过支付密码,提示设置密码
  138. this.showSetPswModal = true
  139. }
  140. }
  141. })
  142. }
  143. },
  144. // 关闭弹窗
  145. closeModal() {
  146. this.showPayModal = false
  147. this.password = ''
  148. },
  149. // 输入密码完成 支付
  150. confirm(e) {
  151. if(this.password == ''){
  152. uni.showToast({
  153. title: '请输入支付密码',
  154. icon: 'none'
  155. })
  156. return
  157. }
  158. let data = {
  159. "payPassword": this.password,
  160. "changeNum": this.number,
  161. "remarks": this.remarks,
  162. "officialPartnerNo": this.partnerNo
  163. }
  164. sellerReceive(data).then(res => {
  165. console.log(res)
  166. if(res.status == 200){
  167. uni.redirectTo({
  168. url: '/pages/checkOut/checkFinish?num='+this.number
  169. })
  170. }
  171. })
  172. }
  173. },
  174. }
  175. </script>
  176. <style lang="less">
  177. page{
  178. height: 100%;
  179. }
  180. .page-content{
  181. width: 100%;
  182. height: 100%;
  183. padding: 20upx;
  184. background-color: #f8f8f8;
  185. .content{
  186. background-color: #fff;
  187. }
  188. .num-cont{
  189. width: 100%;
  190. padding: 16upx;
  191. display: flex;
  192. align-items: center;
  193. justify-content: space-between;
  194. .num-input{
  195. display: flex;
  196. align-items: center;
  197. justify-content: center;
  198. >u-input {
  199. width: 300upx;
  200. }
  201. }
  202. }
  203. .pay-btn{
  204. padding: 0 30upx;
  205. .total {
  206. display: flex;
  207. align-items: center;
  208. justify-content: center;
  209. font-size: 48upx;
  210. font-weight: 600;
  211. color: red;
  212. padding: 60upx 0;
  213. }
  214. }
  215. }
  216. .slot-content{
  217. padding: 30upx 0;
  218. display: flex;
  219. flex-direction: column;
  220. align-items: center;
  221. justify-content: space-between;
  222. .slot-title{
  223. font-size: 36rpx;
  224. }
  225. .text-cont{
  226. width: 100%;
  227. margin-top: 20upx;
  228. // font-size: 20rpx;
  229. >view {
  230. padding: 10upx 80upx;
  231. display: flex;
  232. >text{
  233. &:last-child {
  234. flex: 1;
  235. padding-left: 30upx;
  236. }
  237. }
  238. .num-big{
  239. font-size: 36upx;
  240. color: red;
  241. padding-left: 30upx;
  242. font-weight: 600;
  243. }
  244. }
  245. .num-text{
  246. align-items: center;
  247. >view {
  248. display: flex;
  249. align-items: center;
  250. }
  251. }
  252. }
  253. .footer{
  254. width: 80%;
  255. border-bottom: 1px solid #b1b1b1;
  256. >input {
  257. text-align: center;
  258. padding: 10upx 0;
  259. }
  260. }
  261. .fot-btn{
  262. margin-top: 30upx;
  263. }
  264. }
  265. </style>