checkOut.vue 6.1 KB

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